Skip to content

Instantly share code, notes, and snippets.

@joecannatti
Created December 28, 2011 02:13
Show Gist options
  • Save joecannatti/1525845 to your computer and use it in GitHub Desktop.
Save joecannatti/1525845 to your computer and use it in GitHub Desktop.
euler67
#!/usr/bin/env Rscript
triangle <- read.table("padded_triangle.txt")
size <- 100
for(r in (size-1):1){
for(c in r:1){
max_value = max(triangle[r+1,c],triangle[r+1,c+1])
triangle[r,c] <- triangle[r,c] + max_value
}
}
print(triangle[1,1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment