Campbell Ritchie wrote:Forget all about arrays. Write down on paper how you would do it without using any computing words. Once you have that algorithm you can simply convert it to code.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
fred rosenberger wrote:variable, method, "out of bounds", index, function, array, "[0][0]"...
these are all computing/programming words.
pretend you are talking to a ten year old child. you need to give them directions on how to find this path.
for example...I would have written this:
1) create a variable count. to count the steps
like this:
1) get a piece of paper on which I will keep track of how many steps I've taken.
"Il y a peu de choses qui me soient impossibles..."
Stevens Miller wrote:I'm having a hard time understanding what the assignment is. If he starts at (0,0) and must move to (n-1,n-1), with each step indexing its dimension by one greater than the previous step, that only allows one path, doesn't it? (I'm thinking it's this: (0,0), (1,1), (2,2)... (n-1,n-1) )
"Il y a peu de choses qui me soient impossibles..."
Dan D'amico wrote:
but the path must be like that : if you go your way through the path. each value must be greater than the one before him
so a vaild path in this matrix for example , will be
3 4 6 9 10
7 9 10 11 12
3 6 7 3 13
1 7 8 9 15 so the shortest pathhere will be (0,0)(1,0)(1,1)(1,2)(1,3)(1,4)(1,5)(1,6)
so the method goal is to return 8 , which is the shortests path in this matrix
Dan D'amico wrote:...having a problem to find the longest worm in the matrix.
There are three kinds of actuaries: those who can count, and those who can't.
If a regular clown is funny, then a larger clown would be funnier. Math. Verified by this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|