MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/3uyl7s/daily_programming_puzzles_at_advent_of_code/cxiz1az/?context=3
r/programming • u/Aneurysm9 • Dec 01 '15
179 comments sorted by
View all comments
Show parent comment
1
Another functional approach for the second one (in beautiful O(n2) time):
c = [x == "(" and 1 or -1 for x in list(str)] [x for x in xrange(1, len(c)+1) if sum(c[0:x]) == -1][0]
View all comments
Show parent comment
1
u/knipil Dec 01 '15
Another functional approach for the second one (in beautiful O(n2) time):