Created
December 2, 2015 16:53
-
-
Save ninnypants/268ef0a6662ba3ca9968 to your computer and use it in GitHub Desktop.
Advent of code day 1. Answer for character that put reached floor -1 first. Answered first question by using editor to count parenthesis.
This file contains 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
var instructions = ['','(','(','(','(','(',')','(','(',')','(','(','(','(','(','(','(','(',')',')',')','(','(','(','(',')','(','(','(','(','(',')','(',')',')','(','(',')',')','(',')','(','(','(','(',')','(','(','(','(','(','(','(',')','(','(','(',')','(','(',')','(','(','(','(',')','(','(',')','(','(','(',')',')',')',')','(',')','(','(','(',')','(',')','(',')',')',')',')',')',')',')',')',')',')','(',')','(','(','(','(','(','(','(',')',')','(','(','(',')',')',')','(','(','(','(','(','(',')','(','(','(','(','(','(','(','(','(','(',')','(',')',')',')','(','(','(',')','(','(',')',')','(',')','(','(','(',')',')','(','(','(',')','(','(',')',')',')','(','(','(',')',')',')','(',')',')',')','(',')','(','(','(','(','(','(',')','(','(','(','(',')','(',')',')',')','(',')','(',')',')','(','(','(',')','(','(','(','(','(',')',')','(',')','(',')',')','(',')','(','(','(','(','(',')',')','(',')','(','(',')','(','(',')','(','(','(','(',')','(','(',')',')','(','(',')','(','(',')',')','(','(','(','(','(','(','(','(',')',')','(',')','(',')','(','(','(','(',')',')','(','(',')','(','(',')','(','(',')','(','(',')',')',')',')','(','(',')','(','(','(','(','(',')',')','(','(','(',')',')',')','(','(','(','(',')','(','(',')','(',')','(','(','(','(','(','(',')','(',')','(','(',')','(','(','(','(',')','(','(','(','(','(','(',')',')','(',')',')',')','(',')','(','(','(',')','(','(',')',')',')','(',')','(','(','(',')','(','(','(','(','(',')',')','(','(','(','(','(',')',')','(','(',')','(','(','(','(',')',')','(',')','(',')','(','(',')','(',')','(',')','(',')','(',')','(','(',')',')','(','(','(','(','(',')',')','(','(','(',')',')','(','(',')','(',')',')',')','(',')','(','(','(','(','(',')',')',')',')','(','(','(','(','(',')','(',')',')','(',')','(','(','(','(','(',')',')','(','(','(',')','(',')',')','(','(','(',')',')','(','(',')',')','(','(','(','(','(','(',')','(','(','(','(','(',')','(','(','(','(',')','(','(','(','(','(',')',')','(','(',')','(','(','(','(',')','(',')',')',')','(',')',')',')','(','(','(','(','(','(','(',')','(','(','(',')',')','(',')','(',')',')',')',')','(','(','(','(',')','(','(',')',')',')','(','(',')','(',')','(','(',')','(','(','(','(',')','(','(',')',')',')','(','(','(',')','(',')','(',')','(',')',')','(','(','(',')','(',')','(',')','(','(','(','(',')',')','(',')',')','(',')','(',')',')','(',')',')','(',')',')','(','(','(',')',')',')','(','(',')','(','(',')',')',')','(','(','(','(','(','(',')','(','(',')','(','(',')',')','(','(','(',')','(','(',')',')','(','(',')',')','(',')','(','(','(','(','(',')','(',')',')','(',')',')',')','(','(','(','(','(',')',')','(','(',')',')','(','(','(',')',')','(',')',')','(','(','(','(','(',')','(','(','(','(',')',')','(','(',')',')','(','(','(',')','(',')','(','(','(','(','(',')','(','(','(','(','(','(','(',')','(','(',')',')','(',')','(',')','(','(',')','(','(',')','(',')','(','(','(','(','(',')',')',')','(','(',')',')','(',')','(',')',')','(',')',')',')','(','(',')',')',')',')','(','(',')',')',')',')','(',')',')','(',')','(',')','(','(',')',')','(','(',')',')',')','(',')','(','(','(',')','(','(',')','(','(',')',')','(',')','(',')',')',')','(','(',')','(',')',')',')',')',')',')','(','(',')',')',')','(','(',')','(',')',')',')','(','(',')',')','(','(','(','(','(','(',')','(','(',')','(','(',')','(',')','(','(','(',')',')','(',')','(',')',')',')',')',')',')','(','(','(',')',')','(',')',')','(','(','(',')',')','(','(',')','(','(',')',')','(','(','(',')',')',')','(','(',')',')','(','(','(','(',')','(','(','(','(','(','(','(','(','(',')','(',')','(',')','(','(',')',')',')','(',')','(',')','(','(','(','(',')',')',')','(',')','(','(','(',')','(',')','(','(',')',')','(','(',')',')','(',')',')','(',')','(','(',')','(','(',')',')',')',')','(','(','(','(','(','(',')','(','(',')',')','(','(',')',')','(','(',')',')',')',')',')','(',')',')','(',')',')',')','(','(',')',')',')','(',')','(','(',')','(','(','(','(','(','(','(','(',')','(','(','(','(','(',')',')',')',')','(',')',')','(',')',')','(',')',')','(',')',')','(',')','(','(','(','(','(','(','(','(','(','(','(','(','(','(','(',')','(',')','(','(','(','(','(','(','(',')','(',')','(',')','(',')',')','(',')',')','(',')','(',')',')','(',')',')','(',')',')','(','(',')',')','(','(',')',')',')',')','(',')',')','(','(','(',')','(',')',')','(','(','(',')','(','(',')',')',')',')',')',')',')','(',')',')',')',')',')',')',')',')',')',')',')',')',')',')',')',')',')','(',')',')','(','(','(',')',')','(','(','(',')',')','(',')','(',')',')',')',')',')',')',')','(','(','(','(',')','(','(','(',')','(','(',')','(',')',')',')','(','(','(',')',')','(','(',')','(',')',')',')','(',')','(',')','(',')',')',')',')','(','(',')',')',')',')',')',')',')',')','(','(',')','(','(','(','(',')',')',')',')','(',')',')','(',')','(',')',')',')',')','(',')','(',')','(','(',')',')','(',')',')',')','(',')','(','(',')',')',')','(',')',')','(','(','(',')','(',')',')',')',')',')','(','(',')',')',')',')',')','(',')',')',')','(','(',')','(',')','(','(',')',')',')',')',')',')',')',')','(',')','(','(','(','(',')',')',')',')',')','(',')','(','(',')',')',')','(','(',')',')','(',')',')',')',')',')',')','(',')',')',')','(','(','(',')',')',')','(','(','(',')',')',')','(',')',')','(','(',')',')',')',')',')',')',')',')',')',')','(','(','(','(','(',')',')','(',')',')',')','(',')',')',')','(',')',')',')','(',')',')','(','(',')',')','(',')','(',')','(','(',')',')',')',')','(',')',')',')',')','(','(',')','(',')',')','(',')',')',')','(','(','(',')','(',')','(','(',')',')',')',')','(','(',')',')','(','(','(','(','(','(','(',')','(','(',')',')','(','(','(',')','(','(','(','(',')','(','(',')','(',')','(','(',')',')',')',')','(',')',')',')',')',')',')',')','(',')',')',')','(',')','(','(',')','(','(','(',')',')',')','(',')','(','(',')',')',')','(','(',')','(','(','(','(',')',')','(','(','(','(','(',')',')','(',')',')','(','(',')',')','(','(',')',')',')',')',')',')',')',')',')','(',')',')',')',')',')',')',')',')','(',')',')','(',')',')',')',')',')',')','(',')',')',')',')',')',')','(',')','(',')','(','(','(','(',')',')','(',')','(','(',')',')',')',')',')',')',')',')',')','(',')',')',')',')',')',')','(','(',')',')','(',')','(',')','(',')',')',')','(',')',')',')','(',')',')',')','(','(',')','(','(',')',')','(',')','(',')','(',')',')','(',')',')',')',')',')',')',')',')','(',')',')','(',')','(','(',')','(','(',')',')',')',')',')','(',')','(',')','(',')',')',')',')',')','(',')',')','(','(',')',')',')',')',')','(',')','(',')',')',')',')',')','(',')','(',')',')',')',')',')',')','(','(','(','(',')',')','(',')','(',')',')',')','(','(',')',')',')',')',')',')',')',')',')',')',')','(',')','(',')',')',')',')',')','(',')','(',')','(',')',')',')',')',')','(','(',')','(',')',')','(',')',')','(',')','(',')','(',')',')','(',')','(','(',')',')',')',')',')','(',')','(','(',')',')',')','(','(',')',')',')',')',')',')',')',')','(','(','(','(','(','(',')',')','(','(',')',')','(',')',')','(',')','(',')',')',')','(',')','(',')',')',')','(','(',')',')',')',')',')',')','(',')','(','(',')',')',')',')',')','(','(',')',')','(','(',')','(',')',')',')','(',')','(',')',')','(',')',')',')','(',')',')',')','(',')',')',')','(',')',')',')',')',')','(',')',')','(',')','(',')',')',')','(',')',')','(',')',')',')',')','(','(',')',')',')','(','(',')',')',')',')',')',')',')','(',')',')','(',')','(','(','(','(',')',')','(',')',')',')',')',')',')',')',')',')','(',')',')',')','(',')','(',')',')',')',')','(',')',')',')',')','(',')',')',')',')','(',')',')',')',')',')',')',')',')',')',')',')','(',')','(',')',')',')','(','(',')','(',')',')',')',')',')',')',')','(','(',')',')','(',')','(','(',')',')',')',')',')','(',')',')','(','(',')',')',')',')',')','(','(',')',')',')',')',')','(','(',')','(',')',')',')',')',')',')','(',')',')','(',')',')','(',')','(',')',')',')',')',')','(',')',')','(',')',')',')',')',')',')',')',')',')','(','(',')',')',')',')',')','(',')',')',')',')',')',')',')','(',')','(','(',')','(',')',')',')',')',')',')',')',')','(',')',')',')','(',')',')',')',')','(',')',')',')',')','(',')',')',')',')','(',')',')',')',')',')',')',')',')','(',')',')','(','(',')','(',')',')',')',')',')',')',')','(','(',')','(',')',')','(',')',')',')',')','(',')','(',')',')','(',')',')',')',')',')',')',')',')',')',')',')',')',')',')',')','(',')',')',')',')','(',')','(','(',')',')',')',')','(',')',')',')','(',')',')','(',')','(',')','(','(',')',')','(','(',')','(',')',')',')','(','(',')',')',')',')','(',')',')','(',')','(',')',')','(','(',')','(','(',')','(','(',')',')',')',')',')','(',')',')',')',')',')',')',')',')',')',')',')',')','(',')',')','(','(',')',')',')','(',')',')',')','(',')',')',')',')',')','(','(',')',')','(',')','(',')',')','(',')','(',')',')',')',')',')',')',')',')',')',')',')',')','(',')','(',')',')',')',')',')',')',')',')',')',')',')',')',')','(',')',')','(',')',')',')',')',')',')','(','(',')','(',')',')',')',')',')',')',')',')',')',')',')',')','(',')',')','(','(',')',')',')',')','(',')',')',')',')',')',')',')',')',')','(',')',')','(',')',')','(','(',')',')',')','(',')',')',')','(','(',')',')',')',')','(',')',')',')','(',')','(',')','(','(',')',')','(',')',')',')',')',')',')',')','(',')','(','(','(','(','(',')',')','(',')',')',')','(',')',')','(',')',')',')',')',')',')','(',')',')',')','(',')',')',')',')',')','(','(','(',')','(',')',')','(',')',')',')',')',')','(',')',')',')',')','(','(',')',')',')',')',')',')',')',')',')',')',')',')',')',')',')',')',')',')','(',')',')',')',')',')','(',')','(',')','(',')',')','(',')',')',')','(',')','(',')',')',')',')',')','(',')',')','(',')',')',')','(','(','(',')','(',')',')',')',')','(',')',')',')',')','(','(',')',')',')','(','(',')','(',')',')',')',')',')',')',')',')','(',')',')',')','(',')',')',')',')',')','(','(',')',')',')',')',')',')',')',')','(','(',')',')',')',')',')',')','(',')',')','(',')','(',')','(','(',')',')',')','(',')',')','(',')',')',')','(',')','(',')',')',')',')',')','(',')',')','(',')','(',')',')',')',')',')','(',')',')','(',')',')',')','(',')',')',')',')',')',')',')',')','(','(',')',')',')',')',')','(',')','(',')',')','(',')',')',')',')',')',')',')',')',')','(','(',')',')',')','(',')',')',')',')','(','(',')',')',')','(',')',')',')',')',')','(','(',')',')','(',')',')',')','(',')',')','(',')',')','(','(',')',')','(',')',')','(',')',')',')',')',')',')',')',')','(','(','(','(','(',')',')',')',')',')',')','(',')',')',')','(',')',')',')','(',')','(',')',')','(',')','(','(',')',')',')',')','(',')',')',')','(',')',')',')','(',')','(',')',')','(','(',')','(',')',')','(',')','(',')','(','(',')','(',')',')','(',')',')',')',')',')','(',')',')','(',')',')',')',')',')',')','(','(',')',')',')','(',')',')',')',')',')','(',')',')','(','(',')','(',')','(','(',')',')',')',')',')',')','(','(',')',')','(',')','(',')','(','(','(',')',')','(',')',')',')',')',')',')','(','(',')',')','(','(',')',')',')',')',')',')',')',')','(',')',')',')',')',')',')',')',')',')',')','(',')','(','(',')',')',')',')',')',')',')',')','(',')','(',')',')','(',')',')','(',')',')','(',')','(','(',')',')',')',')',')',')',')',')',')','(','(',')',')',')',')',')',')',')',')',')','(',')',')','(',')','(',')',')',')','(',')','(','(',')',')',')',')',')',')',')','(',')',')',')',')',')',')',')','(',')',')',')',')',')',')',')',')','(','(',')',')',')',')','(',')','(',')','(','(',')',')','(',')','(',')',')',')',')',')',')','(','(','(','(',')',')',')',')','(',')','(','(','(',')',')','(',')',')',')','(',')',')',')',')','(','(',')','(',')',')',')','(',')',')','(','(',')',')','(',')',')',')',')','(',')','(','(','(','(',')','(',')',')',')',')',')',')','(',')','(','(',')','(',')','(',')',')',')',')','(',')','(',')','(','(',')','(',')','(','(',')','(',')',')',')','(',')',')','(',')','(','(',')','(',')','(',')',')',')','(',')',')','(',')','(',')',')',')','(',')','(',')',')','(','(',')',')',')',')',')','(',')',')',')',')',')',')','(',')',')',')',')','(','(',')',')','(',')','(',')',')',')',')',')','(','(',')',')',')',')',')','(','(',')',')','(','(',')',')',')','(','(',')',')',')',')',')',')','(',')','(',')',')',')','(',')',')',')',')',')','(',')',')','(',')',')',')','(',')','(',')','(','(',')',')','(',')',')',')',')','(','(','(',')',')',')','(',')',')','(',')',')',')',')',')',')',')','(',')','(',')',')',')',')',')','(','(','(',')','(','(',')',')',')',')',')','(',')','(',')',')',')',')',')',')',')','(',')',')',')',')',')',')','(',')',')','(','(',')','(','(','(',')','(',')',')',')',')',')',')',')',')',')',')',')',')','(',')','(',')',')','(',')',')',')',')','(',')',')',')','(','(',')',')',')',')',')',')',')','(','(',')',')',')','(','(',')',')','(',')','(',')',')',')',')','(','(',')',')',')',')',')',')',')',')',')','(',')',')','(',')','(',')','(',')','(',')',')',')',')',')','(','(',')','(',')',')',')',')',')',')',')',')','(','(','(',')',')',')',')','(',')',')',')','(','(',')',')',')','(','(',')',')','(','(',')',')','(',')','(',')',')','(',')',')',')',')',')',')',')',')',')','(','(',')',')',')',')','(',')',')',')',')','(','(',')',')',')','(',')','(',')',')',')','(','(',')','(',')',')',')','(','(',')',')',')','(',')',')',')',')','(',')','(','(',')',')',')',')','(',')',')','(','(','(',')','(','(','(',')','(','(',')',')',')',')','(','(','(',')',')',')',')','(',')',')',')',')',')','(','(','(','(','(',')',')','(',')',')','(',')','(',')',')',')',')','(','(',')',')',')',')','(',')',')',')',')',')',')',')','(',')',')','(','(',')','(',')','(','(','(',')',')',')',')','(',')',')','(',')','(','(',')','(',')',')',')',')',')',')','(','(',')','(',')',')','(',')',')',')','(',')',')',')',')',')',')',')',')','(','(','(',')',')','(',')',')',')',')',')',')',')',')','(','(',')','(','(',')',')',')','(',')',')','(',')','(',')','(','(',')','(',')','(','(','(','(',')','(','(','(','(',')','(',')',')',')',')',')',')','(',')',')',')',')',')',')',')','(',')','(','(',')',')','(','(',')','(',')','(','(','(',')','(',')','(','(',')',')','(',')','(',')',')',')','(',')',')','(',')','(',')',')','(',')',')',')','(',')','(',')',')','(',')',')','(',')',')',')',')',')',')',')',')','(','(','(','(',')',')',')',')',')',')',')',')','(',')','(',')',')',')',')',')',')',')','(','(','(','(',')',')','(',')',')',')','(','(',')','(',')',')',')','(','(',')','(',')',')',')',')',')','(','(',')','(','(',')','(',')','(','(','(','(','(',')',')','(',')','(',')',')','(','(','(',')','(',')',')',')',')',')','(','(',')','(','(',')',')',')',')',')',')','(',')','(','(','(',')','(',')','(',')','(',')',')','(',')','(',')','(','(','(',')','(','(','(',')','(',')',')',')','(','(',')',')',')','(','(','(','(',')','(',')','(',')',')',')','(','(','(','(',')',')',')',')','(',')','(','(','(','(',')',')','(',')',')',')',')',')',')',')','(','(','(',')','(','(',')',')','(',')',')',')',')','(','(',')','(',')',')','(','(','(','(','(','(',')','(','(',')',')',')','(','(',')','(','(','(',')',')',')','(','(',')','(',')',')','(',')',')',')',')',')','(','(',')','(','(',')',')',')','(',')','(','(',')',')',')','(','(',')',')','(','(','(','(',')',')','(','(',')','(',')',')',')',')',')','(',')','(',')',')',')','(','(','(','(',')',')',')',')',')','(','(',')','(',')','(',')','(',')',')',')','(',')',')',')',')','(','(','(',')','(',')','(',')','(','(',')',')','(',')',')',')','(',')',')',')',')',')','(',')','(',')',')',')','(',')',')',')',')',')',')',')','(','(','(','(','(','(','(',')','(',')','(',')',')',')',')',')','(',')',')','(','(','(',')','(',')','(','(','(','(',')',')',')',')',')','(','(',')','(','(',')',')','(','(',')','(',')','(',')',')','(',')',')','(',')',')',')',')','(',')','(','(','(','(',')','(',')',')',')','(','(',')',')','(','(','(',')',')',')',')','(','(',')',')',')','(','(',')','(',')','(',')','(',')',')','(','(','(',')',')','(',')',')','(',')',')','(','(',')',')',')',')',')','(',')',')',')','(',')','(','(','(',')','(','(',')',')','(',')','(','(',')','(',')','(','(',')',')','(','(',')',')',')','(','(',')',')','(',')',')',')','(','(',')',')','(','(',')',')',')',')',')','(','(',')',')','(','(',')',')','(',')',')','(','(',')','(',')','(','(',')','(','(','(',')','(',')','(','(','(',')',')',')',')','(','(','(',')',')',')','(',')','(','(','(',')',')',')',')','(','(','(','(',')','(',')','(',')','(',')','(','(','(','(','(',')',')',')','(','(',')','(',')',')',')','(',')','(',')','(',')','(','(','(','(',')',')','(','(','(',')',')','(',')',')','(','(',')','(',')','(','(',')','(',')','(',')',')',')','(',')','(','(','(',')',')','(','(',')',')','(',')',')',')','(',')',')','(','(','(','(',')','(',')','(','(',')',')',')',')','(',')','(','(','(',')','(',')','(',')',')','(',')','(',')',')','(','(',')','(','(',')',')','(',')',')','(','(','(','(',')',')','(','(',')',')','(',')',')','(','(','(',')',')','(','(',')',')','(',')','(','(','(','(',')','(',')',')',')','(','(',')',')',')',')','(','(','(',')',')','(','(',')','(',')',')','(',')',')','(','(',')',')','(','(','(',')','(',')','(',')','(','(','(','(','(','(','(',')',')',')',')','(','(','(',')','(','(','(','(','(','(',')',')','(',')',')',')','(',')',')',')','(','(',')',')','(','(',')','(',')',')',')','(',')',')',')','(','(',')',')','(',')','(',')',')',')','(','(',')',')','(','(','(',')','(',')','(',')',')','(',')','(',')','(','(',')',')',')','(',')',')','(',')','(','(','(',')',')',')',')','(',')','(','(','(',')','(',')','(',')',')','(','(','(','(','(',')','(',')',')','(','(','(',')',')','(',')',')','(',')',')','(','(','(',')','(','(','(',')',')',')','(',')',')',')','(','(','(',')',')','(','(','(',')','(',')','(','(',')','(','(','(',')','(',')','(','(','(','(',')',')','(','(',')','(',')',')',')',')',')','(','(','(',')','(','(','(',')',')','(',')','(','(','(','(',')',')','(','(',')','(','(','(',')',')','(',')',')','(','(','(',')',')','(','(',')','(','(','(','(','(','(','(',')',')','(',')',')','(',')','(','(',')','(',')',')','(',')','(','(',')',')','(','(','(','(',')',')','(','(','(','(','(','(','(',')','(','(',')',')','(','(',')','(','(','(',')','(',')','(',')','(','(','(',')','(',')','(','(',')','(',')','(',')','(',')',')',')',')','(',')','(',')','(','(','(','(','(','(',')','(',')',')',')','(',')','(','(','(','(','(','(','(',')',')',')','(',')','(','(',')','(','(',')','(','(',')','(','(','(','(',')','(',')',')','(','(','(',')',')',')','(',')',')','(',')','(','(','(',')',')',')','(','(',')',')',')',')','(',')',')',')','(',')','(',')',')',')','(',')',')','(',')','(',')',')',')','(',')',')','(','(','(','(','(',')',')','(','(',')','(','(',')',')',')','(','(','(','(','(','(','(','(',')',')','(','(','(','(',')','(','(','(','(','(','(',')','(','(','(','(',')','(',')','(','(','(','(','(',')',')','(','(','(','(',')',')','(',')',')',')',')','(','(',')','(',')','(',')','(','(',')','(','(',')',')',')','(',')',')',')','(','(','(','(','(','(','(',')',')',')','(','(','(',')','(','(','(','(',')','(','(',')',')','(','(','(',')','(','(','(','(','(',')','(','(','(','(','(','(','(',')',')','(','(','(','(','(','(',')',')',')',')','(','(','(','(',')','(','(',')',')',')',')',')','(','(','(','(',')','(','(','(','(',')',')','(',')','(','(','(',')',')','(','(',')','(','(','(',')',')',')','(','(','(','(',')','(',')','(','(','(','(',')',')','(','(','(','(','(',')','(','(',')','(','(','(','(','(','(',')',')',')','(','(','(','(',')','(','(','(','(','(','(','(','(',')','(','(',')','(',')','(',')','(','(',')','(','(',')','(','(',')','(',')','(',')',')','(','(',')',')','(','(','(','(','(','(',')','(','(',')',')','(',')',')','(',')','(',')',')','(','(',')','(','(',')','(','(',')',')',')','(',')','(','(',')','(',')','(',')','(',')',')','(','(',')','(',')','(','(',')','(','(','(',')',')',')','(',')','(','(','(',')',')','(',')',')','(',')','(','(',')',')',')','(','(','(',')',')','(','(',')',')',')','(',')','(','(',')',')',')','(',')','(','(','(','(',')','(','(',')','(','(',')','(','(','(','(','(','(','(',')','(',')','(',')','(',')','(',')',')','(',')','(','(','(','(','(','(',')','(',')','(','(','(','(',')','(',')','(',')','(','(','(',')','(','(','(','(','(','(',')',')',')','(','(','(','(','(','(','(','(','(',')','(',')','(',')','(','(','(','(','(','(',')',')',')',')',')',')',')','(','(',')','(',')','(',')','(','(',')',')','(','(',')',')',')','(','(',')','(',')',')',')',')',')','(','(',')',')','(',')',')',')','(','(','(','(','(','(',')','(','(','(','(','(','(',')','(',')','(','(',')','(','(',')','(',')',')','(','(','(','(',')',')',')','(','(','(','(','(',')','(','(','(',')','(','(',')','(','(',')','(','(','(',')','(','(',')','(','(','(',')',')',')',')','(',')','(','(','(','(',')','(','(','(',')',')',')','(','(','(',')',')',')','(','(','(','(','(','(','(','(','(','(',')','(','(','(',')','(','(','(',')','(','(',')',')',')',')','(',')','(','(','(','(','(',')','(','(','(',')','(',')',')',')','(','(','(',')',')','(','(','(','(',')','(','(','(','(','(','(',')','(',')','(','(',')','(','(',')','(',')','(','(','(',')','(','(',')','(',')','(',')','(','(','(','(','(','(','(','(',')',')','(',')',')','(',')','(',')',')',')',')',')',')','(','(','(','(','(',')','(',')','(','(',')',')',')','(',')',')',')','(','(',')','(','(','(',')',')','(',')','(','(',')','(','(','(','(','(','(','(','(','(','(',')','(',')','(','(','(','(',')','(','(',')','(',')',')','(','(',')','(','(','(',')','(',')',')','(','(','(',')',')','(',')',')','(','(','(','(','(',')','(','(','(','(',')','(','(','(','(',')','(','(','(','(','(',')','(','(','(',')','(','(','(','(','(',')','(','(',')','(','(','(','(','(','(','(',')',')','(','(','(','(','(','(','(','(','(','(','(','(','(',')','(',')','(','(',')','(',')','(','(','(','(','(','(','(','(','(','(','(','(','(','(','(',')','(','(','(',')','(',')',')',')','(',')','(','(','(','(','(','(','(','(','(','(','(','(','(',')',')','(','(','(','(','(',')','(','(',')','(',')',')','(','(','(',')','(','(',')','(','(',')',')',')','(',')','(','(','(','(','(','(',')','(',')','(','(','(','(',')','(',')',')',')','(',')','(',')',')','(','(',')',')','(','(','(',')','(','(','(','(','(','(',')','(','(','(',')',')','(','(','(','(','(','(',')','(','(','(',')','(','(','(','(','(','(',')',')',')','(',')','(',')','(','(','(','(','(',')',')','(',')','(','(','(','(','(',')',')','(','(','(','(','(','(','(','(','(','(',')','(','(',')',')','(','(',')','(','(',')',')',')',')','(',')',')','(','(',')','(','(','(',')',')','(','(','(','(',')',')','(','(',')',')','(','(',')',')','(',')',')','(','(',')','(','(',')','(','(',')',')','(',')','(',')','(','(','(',')','(','(','(',')',')','(',')','(','(','(','(',')','(','(','(','(','(','(',')','(','(',')',')',')',')','(',')','(','(','(','(',')','(','(','(',')',')',')',')','(','(','(',')','(',')','(',')','(','(','(','(',')','(','(','(','(',')','(','(','(',')','(','(',')','(','(',')',')','(','(',')','(','(','(',')','(',')',')','(','(',')','(','(',')','(','(','(','(',')','(','(','(','(','(','(','(','(','(','(',')',')','(','(',')','(','(','(','(','(',')','(',')',')',')','(','(',')','(','(','(','(','(',')','(',')','(',')','(',')','(','(','(','(',')','(','(','(','(','(','(','(','(','(',')','(','(',')','(',')','(','(','(','(','(','(','(',')','(','(',')','(',')','(','(',')','(','(','(',')','(','(','(','(','(','(','(','(','(','(','(',')','(',')','(','(','(','(','(','(','(','(',')','(',')',')','(','(',')',')',')',')','(','(','(','(',')','(',')',')',')','(','(','(','(','(','(',')','(','(','(',')','(',')','(',')',')','(','(',')','(',')','(','(','(','(','(',')',')','(','(','(',')','(','(','(','(','(',')',')',')',')',')','(','(',')',')','(','(','(',')','(','(',')','(',')','(','(','(','(',')','(','(',')','(','(','(','(',')','(','(','(','(','(',')','(','(','(','(','(','(',')',')',')','(',')',')','(',')',')','(','(',')','(','(','(',')',')','(',')',')',')','(','(','(','(',')','(',')',')','(','(','(',')',')','(','(','(',')',')','(','(','(','(','(',')','(','(','(',')','(','(','(','(','(','(','(',')',')','(','(',')','(','(','(','(','(',')','(',')',')',')','(','(','(','(','(','(','(',')',')','(',')','(','(',')',')',')','(','(','(',')','(','(','(','(',')',')','(','(','(','(','(','(','(','(','(','(','(',')','(',')','(','(','(','(','(','(',')','(','(','(','(','(','(',')','(','(','(',')','(',')','(',')','(','(','(','(','(',')',')',')',')','(','(',')',')',')','(',')','(','(','(',')','(','(',')',')','(',')','(',')','(','(','(',')','(','(','(','(','(','(','(','(','(','(','(',')','(','(','(',')',')','(','(',')',')','(','(','(','(','(','(',')','(','(',')','(','(',')','(',')',')',')','(','(','(','(','(',')','(','(','(','(','(',')','(',')','(','(','(',')','(','(','(','(',')','(','(','(','(','(','(','(','(','(','(',')','(','(',')','(','(','(',')','(','(','(',')',')',')','(','(','(','(','(','(','(',')','(','(','(','(',')',')','(',')','(',')','(','(','(',')','(','(','(','(','(','(','(','(',')','(',')',')',')',')','(',')','(',')','(','(',')','(','(','(',')','(','(','(',')','(',')','(','(','(','(',')','(','(',')','(',')','(',')','(',')','(','(','(','(','(',')','(','(','(',')',')','(','(','(','(','(',')','(','(','(','(','(','(','(','(','(','(',')','(','(','(','(',')','(',')','(','(','(','(',')','(','(',')','(','(','(','(',')','(','(','(','(',')','(','(','(',')',')','(',')','(','(',')','(','(','(',')','(','(',')','(','(',')','(','(',')',')',')','(',')','(','(','(','(',')',')',')','(','(',')','(','(','(','(','(',')','(','(','(',')',')','(','(','(','(','(',')',')','(','(','(','(','(','(','(',')',')','(','(',')',')',')','(','(',')','(','(','(','(','(',')',')','(','(','(',')','(','(',')','(','(','(','(','(','(','(','(','(',')','(',')','(','(','(','(','(','(','(',')','(','(',')','(','(',')','(',')','(',')','(','(',')',')','(','(','(',')','(','(','(',')','(',')','(','(','(','(',')','(','(','(','(','(','(','(','(',')','(',')','(','(','(',')','(','(','(','(','(','(','(','(',')',')',')','(','(','(','(','(','(',')','(','(','(','(',')','(','(',')','(',')','(',')','(','(',')','(','(','(','(',')','(','(','(',')','(',')','(','(','(',')',')','(','(',')','(','(','(','(','(','(','(','(','(','(',')','(','(',')','(','(','(',')','(','(','(','(','(','(','(',')','(',')','(','(','(',')',')','(',')',')',')','(','(','(','(','(','(',')','(','(','(',')',')','(',')','(',')',')','(',')','(','(','(','(','(','(','(','(','(','(','(','(',')',')',')','(','(','(','(','(',')','(',')','(',')','(',')','(',')',')','(','(',')','(',')','(','(',')','(','(',')','(',')',')',')','(',')',')',')','(','(',')',')',')','(','(',')','(','(','(','(',')','(',')',')',')','(',')',')','(','(',')','(','(',')',')',')','(',')','(',')','(','(','(',')',')','(','(',')','(',')',')','(',')','(',')',')','(',')','(','(',')',')',')','(',')',')',')','(','(',')','(',')','(','(',')','(','(','(','(','(','(','(',')',')','(','(','(',')','(','(','(','(','(','(','(','(','(','(','(','(',')','(','(',')',')','(',')','(','(','(',')','(','(',')','(','(','(',')','(','(','(',')','(','(',')','(','(','(',')','(','(','(','(','(','(','(','(','(','(','(',')','(',')','(',')',')','(','(','(',')',')','(',')','(','(',')',')',')',')','(','(','(',')',')','(',')','(',')',')','(',')','(','(','(','(','(','(',')','(','(',')','(',')',')','(','(','(','(','(',')','(','(','(',')','(','(',')',')','(','(',')',')',')','(','(','(','(',')',')','(',')','(','(','(',')',')',')','(','(','(','(','(','(',')',')','(','(',')',')',')','(',')','(',')','(','(',')',')',')','(','(','(','(',')',')','(','(','(','(','(',')','(','(','(','(','(',')','(','(',')',')',')',')','(','(','(','(','(','(','(','(',')',')',')',')',')','(',')',')','(',')','(',')',')','(','(',')',')','(','(','(',')',')','(',')','(','(',')','(',')','(','(','(',')','(','(',')',')',')','(',')','(','(',')','(',')','(','(',')','(',')','(','(','(',')','(',')',')','(','(','(',')',')','(','(','(',')','(',')',')',')','(','(','(','(','(',')',')',')','(',')','(',')',')',')','(','(',')','(',')','(','(',')',')','(',')','(',')','(','(','(','(','(','(',')','(','(',')',')','(','(','(',')','(','(','(','(','(',')',')',')','(',')',')',')','(','(',')','(',')',')','(',')',')','(','(','(','(',')','(',')','(','(',')','(',')',')',')','(','(',')',')',')',')',')',')','(','(',')',')',')','(','(','(',')',')','(','(','(','(','(','(',')','(','(','(','(','(',')',')',')','(',')','(','(','(','(','(',')',')',')','(',')','(','(','(',')',')','(','(','(','(',')',')',')',')','(','(','(','(',')','(',')',')',')',')','(','(','(',')','(','(',')','(',')','(','(']; | |
var floor = 0; | |
for ( var i = 0; i < instructions.length; i++ ) { | |
if ( '(' === instructions[ i ] ) { | |
floor += 1; | |
} else if ( ')' === instructions[ i ] ) { | |
floor -= 1; | |
} | |
if ( -1 === floor ) { | |
console.log( i ); | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment