This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // node class | |
| class Node { | |
| constructor(value, left, right) { | |
| this.value = value | |
| this.left = left | |
| this.right = right | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # let's pretend we're building a web service - incoming data (ARGV[0]) will probably be a json string | |
| require 'json' | |
| # define some tests to run in case there is no input | |
| inputs = [ | |
| [1, 2, 3, 4], | |
| [1, 2, [3, 4]], | |
| [1, [2, [3, 4]]], | |
| # this program might actually be useful | |
| [1, [2, [[[[[5]]]]]]], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "os/exec" | |
| "strconv" | |
| "time" | |
| ) | |
| //determine if the user has been idle for a certain amount of time | |
| func deadTime() bool { |