Skip to content

Instantly share code, notes, and snippets.

View GreggSetzer's full-sized avatar

Gregg GreggSetzer

  • USA
View GitHub Profile
@GreggSetzer
GreggSetzer / find-largest-integer-in-array.js
Created July 16, 2018 15:51
JavaScript Interview Question: Largest integer in array?
/*
Return the largest value in an array of non-negative integers
*/
function largestInt(arr) {
if (arr.length === 0) {
return -1;
}
return arr.reduce(comparator);
@GreggSetzer
GreggSetzer / tree.js
Last active July 27, 2018 18:52
JavaScript Interview Question: Tree
class Node {
constructor(data) {
this.data = data;
this.children = [];
}
add(data) {
this.children.push(new Node(data));
}
@GreggSetzer
GreggSetzer / ip.txt
Created August 29, 2018 19:36
Retrieve your local IP address at Mac Command LIne
alias ip='ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d\ -f2'