Skip to content

Instantly share code, notes, and snippets.

View gatarelib's full-sized avatar
Codin'

Gatare Libère gatarelib

Codin'
View GitHub Profile
@gatarelib
gatarelib / change.js
Last active August 14, 2019 12:40
Andela assessment
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;
@gatarelib
gatarelib / ordinal.js
Created August 14, 2019 12:39
Andela assessment
function numberToOrdinal(n) {
if (n==0) {
return n;
}
var j = n % 10,
k = n % 100;
if (j == 1 && k != 11) {
@gatarelib
gatarelib / sorting.js
Created August 14, 2019 12:33
Andela assessment
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 {
@gatarelib
gatarelib / digitize.js
Created August 14, 2019 12:32
Andela assessment Question
const digitize = (n) => {
r = n.toString().split('');
r.forEach((el, i, a) => { a[i] = parseInt(el); })
return r
}
digitize(715) // [7, 1, 5]
@gatarelib
gatarelib / comment.js
Created August 14, 2019 12:31
Andela-assessment
class User {
constructor(name) {
this._name = name;
this._loggedIn = false;
this._lastLoggedInAt = null;
}
isLoggedIn() {
return this._loggedIn;
}
getLastLoggedInAt() {
@gatarelib
gatarelib / InsertionSortAlgo.py
Last active October 8, 2018 05:58
insertion_sort Algo created by ligat - https://repl.it/@ligat/insertionsort-Algo
# 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
@gatarelib
gatarelib / main.py
Created October 8, 2018 05:43
insertion_sort Algo created by ligat - https://repl.it/@ligat/insertionsort-Algo
# 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