Last active
January 5, 2016 16:02
-
-
Save ghaiklor/24fe52c1de96b7b6d894 to your computer and use it in GitHub Desktop.
Advent of Code (Day 1 Part 2)
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
const fs = require('fs'); | |
const INPUT = fs.readFileSync('./input.txt', 'utf-8').split(''); | |
let floor = 0; | |
let result = INPUT.map(direction => direction === '(' ? ++floor : --floor).indexOf(-1) + 1; | |
console.log(result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment