This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Complete the aVeryBigSum function below. | |
| long aVeryBigSum(vector<long> ar) { | |
| long long int total = accumulate(ar.begin(), ar.end(), 0ll); | |
| return total; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def aVeryBigSum(ar): | |
| return sum(ar) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/python3 | |
| import math | |
| import os | |
| import random | |
| import re | |
| import sys | |
| # | |
| # Complete the 'simpleArraySum' function below. | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| #include <numeric> | |
| using namespace std; | |
| vector<string> split_string(string); | |
| /* | |
| * Complete the simpleArraySum function below. | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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): |