I hereby claim:
- I am bflannery on github.
- I am bflanneryatx (https://keybase.io/bflanneryatx) on keybase.
- I have a public key ASCZM5oBZsOAVNP9U1OgIwdKOlCJ08g2peWYNeiuiw1ODwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
// Frequency Counter - sameFrequency | |
// Write a function called sameFrequency. Given two positive intergers, | |
// find out if the two numbers have the same frequency of digits. | |
// Solution Requirements | |
// - Time Complexity: O(n) | |
function sameFrequency(int1, int2) { | |
const int1Arr = Array.from(int1.toString()).map(Number); |
class HashTable { | |
constructor(size) { | |
this.buckets = Array(size); | |
this.numBuckets = this.buckets.length; | |
} | |
hash() { | |
var total = 0; | |
for (var i = 0; i < key.length; i++) { | |
total += key.charCodeAt(i); |
class BST { | |
constructor(value) { | |
this.value = value; | |
this.left = null; | |
this.right = null; | |
} | |
insert(value) { | |
if (value <= this.value) { | |
if (!this.left) this.left = new BST(value); |
class LinkedList { | |
constructor() { | |
this.head = null; | |
this.tail = null; | |
} | |
addToHead(value) { | |
let newNode = new Node(value, this.head, null); | |
if (this.head) this.head.prev = newNode; | |
else this.tail = newNode; |
const _items = new WeakMap() | |
class Stack { | |
constructor(value) { | |
_items.set(this, []); | |
} | |
push(value) { | |
_items.get(this).push(value); | |
} |
const getExchangeRate = async (from, to) => { | |
try { | |
const apiKey = '' // Add unique fixer.io apiKey | |
const response = await axios.get(`http://data.fixer.io/api/latest?access_key=${apiKey}&format=1`) | |
const euro = 1 / response.data.rates[from]; | |
const rate = euro * response.data.rates[to]; | |
if (isNaN(rate)) { | |
throw new Error() | |
} |
@Component({ | |
selector: 'friend-tour', | |
template: ` | |
<input #newFriend | |
(keyup.enter)="addFriend(newFriend.value)" | |
(blur)="addFriend(newFriend.value); newFriend.value='' "> | |
<button (click)="addFriend(newFriend.value)">Add</button> | |
<ul><li *ngFor="let friend of friends">{{friends}}</li></ul> |
// return the sum of the two smallest positive integers | |
function sumTwoSmallestNumbers(numbers) { | |
let sorting = numbers.sort((a,b) => { | |
if(a > b) { | |
return a; | |
} | |
}); | |
return sorting[0] + sorting[1]; |
// Give 3 integers, will they make a triangle | |
function isTriangle(a,b,c){ | |
if(a+b > c && a+c > b && b+c > a) { | |
return true; | |
} else { | |
return false; | |
} | |
} |