dropthebass's blog

By dropthebass, history, 4 months ago, In English,

Hey guys! I'm not sure where I've gone wrong in this problem: SERGRID

A little help would be appreciated! Code

 
 
 
 

»
4 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by sidy_97 (previous revision, new revision, compare).

»
4 months ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

you forgot to mark visited[1][1]=1, i.e answer should be 0 in case 1x1 grid instead of level[n][m]==0 check for visited[n][m]==0

  • »
    »
    4 months ago, # ^ |
    Rev. 4   Vote: I like it 0 Vote: I do not like it

    Hey you mean instead of checking for level[n][m] == 0, I'd check for visited[n][m] == 0 for n = 1,m = 1?

    • »
      »
      »
      4 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      https://ideone.com/w3xJLM

      see here what I meant then ask if its not clear.

      • »
        »
        »
        »
        4 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I understood thanks! I guess i was taking the level array into consideration for the not visited part and also forgot to take the input as a string. Thanks man!