Skip to content

Instantly share code, notes, and snippets.

View codeperfectplus's full-sized avatar
🟢
Online

Deepak Raj codeperfectplus

🟢
Online
View GitHub Profile
function getSecondLargest(nums) {
// Complete the function
let max1 = 0;
for (const e of nums) {
if (max1 < e) {
max1 = e;
}
}
let max2 = 0;
for(const e of nums) {
// Complete the aVeryBigSum function below.
long aVeryBigSum(vector<long> ar) {
long long int total = accumulate(ar.begin(), ar.end(), 0ll);
return total;
}
def compareTriplets(a:list, b:list):
aliceScore = 0
bobScore = 0
for i in range(len(a)):
if a[i] > b[i]:
aliceScore += 1
elif b[i] > a[i]:
bobScore += 1
return [aliceScore,bobScore]
vector<int> compareTriplets(vector<int> a, vector<int> b) {
vector<int> result;
int aliceScore = 0;
int bobScore = 0;
for(int i=0;i<a.size();i++){
if(a[i] > b[i])
aliceScore ++;
else if(b[i] > a[i])
def diagonalDifference(arr):
# Write your code here
d1 = sum(arr[i][i] for i in range(n))
d2 = sum(arr[i][n-i-1] for i in range(n))
return abs(d1 - d2)
#include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
vector<string> split(const string &);
int diagonalDifference(vector<vector<int>> arr) {
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'simpleArraySum' function below.
#
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
vector<string> split_string(string);
/*
* Complete the simpleArraySum function below.
*/
class EvenStream(object):
def __init__(self):
self.current = 0
def get_next(self):
to_return = self.current
self.current += 2
return to_return
class OddStream(object):