Skip to content

Instantly share code, notes, and snippets.

@tvolk131
tvolk131 / CashAmount
Created August 3, 2017 16:56
Hack Reactor CashAmount Interview Prep
class CashAmount {
constructor (amount) {
this.pennyCount = 0;
this.addDoubleAmount(amount);
}
totalAsPennies () {
return this.pennyCount;
}
totalInPennies () {
@tvolk131
tvolk131 / gist:b2224ce7f9750176624f4a932a5c1aae
Created July 20, 2017 16:57
Interview Practice Problem
const findLargestLevel = function(node) {
var getAllNodeSums = function(node, nodeSums) {
nodeSums.set(node, getNodeSum(node));
for(var i = 0; i < node.children.length; i++) {
getAllNodeSums(node.children[i], nodeSums);
}
}
var getNodeSum = function(node) {