Skip to content

Instantly share code, notes, and snippets.

@cwhite92
Last active December 1, 2015 13:58
Show Gist options
  • Save cwhite92/8d333d7ff24a7df83b64 to your computer and use it in GitHub Desktop.
Save cwhite92/8d333d7ff24a7df83b64 to your computer and use it in GitHub Desktop.
AOC Day 1 Golf (credit to jamosaur, phroggyy and mamorunl, thomasruize)
<?php $f=$b=0;foreach(str_split(file('i')[0])as$p=>$d)($f-=$d=='('?-1:1)>=0|$b?:$b=$p+1;echo"$f $b";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment