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
var countChange = function(money, coins) { | |
return findComboCount(money, coins, 0); | |
} | |
function findComboCount(money, coin, index) { | |
if(money === 0){ | |
return 1; | |
} | |
else if (money < 0 || coin.length == index) { | |
return 0; |
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
let power = (a,b) => { | |
if (b <= 1) { | |
return a; | |
} else { | |
return a * power(a, b-1); | |
} | |
}; | |
power(3, 4); |
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 mySort(nums) { | |
let evens = []; | |
let odds = []; | |
for (let i = 0; i < nums.length; i++) { | |
if(typeof nums[i] === "number"){ | |
if ((nums[i] % 2) === 1) { | |
odds.push(parseInt(nums[i])); | |
} | |
else { |
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
const digitize = (n) => { | |
r = n.toString().split(''); | |
r.forEach((el, i, a) => { a[i] = parseInt(el); }) | |
return r | |
} | |
digitize(715) // [7, 1, 5] |
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 User { | |
constructor(name) { | |
this._name = name; | |
this._loggedIn = false; | |
this._lastLoggedInAt = null; | |
} | |
isLoggedIn() { | |
return this._loggedIn; | |
} | |
getLastLoggedInAt() { |
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
# Insertion Sort In Python | |
# | |
# Performance Complexity = O(n^2) | |
# Space Complexity = O(n) | |
def insertionSort(my_list): | |
# for every element in our array | |
for index in range(1, len(my_list)): | |
current = my_list[index] | |
position = index |
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
# Insertion Sort In Python | |
# | |
# Performance Complexity = O(n^2) | |
# Space Complexity = O(n) | |
def insertionSort(my_list): | |
# for every element in our array | |
for index in range(1, len(my_list)): | |
current = my_list[index] | |
position = index |
NewerOlder