Skip to content

Instantly share code, notes, and snippets.

@dekajp dekajp/ProjectEuler_Problem15.js Secret
Last active Dec 15, 2015

What would you like to do?
Project Euler 15 Starting in the top left corner of a 22 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner.
var memory;
var f = function(x,y){
var a=0,b=0;
console.log ( 'x:'+x+ ' y:'+y );
if (memory[x][y] !=0){
return memory[x][y];
if(x===0 && y===0) {
return 0;
if (x===0 || y===0 ) {
return memory[x][y]=1;
memory[x][y]= f(x-1,y)+f(x,y-1);
return memory[x][y];
var start=function(){
memory=new Array(21);
memory[i]=new Array(21);
var result=0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.