This file contains 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 <iostream> | |
#include <vector> | |
#include <iomanip> | |
using namespace std; | |
int main(int argc, char const* argv[]) | |
{ | |
double *sale = nullptr, | |
total = 0, | |
avarage; |
This file contains 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<iostream> | |
#include<vector> | |
using namespace std; | |
int indexOf(int el, vector<int> v, int sizeOfCandidate){ | |
for(int i=0;i< sizeOfCandidate;i++){ | |
if(v[i]==el) return 0; | |
} |
This file contains 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<iostream> | |
#include<vector> | |
using namespace std; | |
int main() { | |
long long n; | |
cin >> n; | |
vector<long long> a; | |
vector<long long> b; |
This file contains 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 tostr(int n) { | |
stringstream s; | |
string x; | |
while (n > 0) { | |
x += (n % 10 + '0'); | |
n /= 10; |
This file contains 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
/** | |
* Created by Hoan Nguyen on 11/11/2017. | |
*/ | |
//Note that: this solution is for array of Intergers ONLY | |
function diffArray(arr1, arr2) { | |
var output = []; | |
// Same, same; but different. | |
arr1.sort((a, b) => a - b); |
This file contains 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
/** | |
* Created by Hoan Nguyen on 11/11/2017. | |
*/ | |
function reverseString(str) { | |
return str.split('').reverse().join(''); | |
} | |
function reverseStrUsingRecursion(str) { | |
if (str.length === 1) return str[0]; |
This file contains 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
/** | |
* Created by Hoan Nguyen on 11/9/2017. | |
*/ | |
/** | |
* @param {character[][]} grid | |
* @return {number} | |
*/ |
This file contains 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
# https://leetcode.com/problems/summary-ranges/description/ | |
class Solution: | |
def summaryRanges(self, nums): | |
""" | |
:type nums: List[int] | |
:rtype: List[str] | |
""" | |
output = [] | |
temp = "" |
This file contains 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
/** | |
* Created by Hoan Nguyen on 11/8/2017. | |
* https://leetcode.com/problems/summary-ranges/description/ | |
* | |
*/ | |
/** | |
* @param {number[]} nums | |
* @return {string[]} | |
*/ |
This file contains 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
/** | |
* Created by Hoan Nguyen on 11/8/2017. | |
* https://leetcode.com/problems/search-for-a-range/description/ | |
*/ | |
var searchRange = function(nums, target) { | |
var found = false; | |
var res = []; | |
for (var i = 0; i < nums.length; i++) { | |
if (nums[i] == target) { |
NewerOlder