why is everyone using 2 d array…wasting space…acc to me ,my code is working for a number of test cases that i have tried…but still it shows the wrong answer…i have just done the dynamic programming approach but in top-bottom manner. …and by comparing the last row’s adjacent elements and thus selecting the maximum…we get the largest sum…

Can you share the link to your submission? In that case, someone can help you!

1 Like
  • try this test case:
  • 1
  • 99
  • 99
  • 99 99
  • 99 99 99
  • 99 99 99 99…
  • you can fill this test case by writing a program to print 4851 99’s and redirect it to a file
  • you can do this in this way:
  • for(i=1;i<=4851;i++)
  •         printf("99 ");
  • and compile this program and run it like this ./a.out > i
  • now open i file and enter 1 and 99 for number of test cases and number of rows
  • now compile your original program and execute like this ./a.out < i
  • correct answer is :9702 but you are getting wrong answer
  • if any doubts comment below :slight_smile:
2 Likes my code…plz review it once…

Invalid solution Id