Skip to content

Instantly share code, notes, and snippets.

@Jartza
Last active August 29, 2015 13:57
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 Jartza/9514159 to your computer and use it in GitHub Desktop.
Save Jartza/9514159 to your computer and use it in GitHub Desktop.
t=require('fs').readFileSync("tree.txt","utf8").split("\n");for(f in t)i=t[f]=t[f--].split(" ");for(;f;)for(s in w=t[f--])i[s]=+w[s]+Math.max(i[s],i[++s]);console.log(i[0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment