Skip to content

Instantly share code, notes, and snippets.

@ninnypants
Created December 2, 2015 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ninnypants/268ef0a6662ba3ca9968 to your computer and use it in GitHub Desktop.
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.
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