Skip to content

Instantly share code, notes, and snippets.

@Samuelachema
Samuelachema / mysort.js
Created August 14, 2018 00:18
Write a mySort function which takes in an array integers, and should return an array of the inputed integers sorted such that the odd numbers come first and even numbers come last.
/*
JavaScript
Write a mySort function which takes in an array integers, and should return an array of the inputed integers sorted such that the odd numbers come first and even numbers come last.
For exampl1e:
mySort( [90, 45, 66, 'bye', 100.5] )
should return
[45, 66, 90, 100]
@zestime
zestime / countChange.js
Created July 21, 2016 00:36
JavaScript ver. of Counting coins
function countChange(money, coins) {
if (money == 0) return 1;
if (money < 0 || coins.length == 0) return 0;
return countChange(money - coins[0], coins) + countChange(money, coins.slice(1));
}