I gave one of the contest from Interview Contest.
More precisely Longest Strictly Increasing Path .
In my first attempt i got Runtime Error , Since Codedrills don’t provide constraints i thought it may be due to my static predefined dp matrix so i increased the size , but increasing size increased Runtime error.
Can you help me with my code, why and how remove RE!
I’ve looked at your code and found the bugs. There are two mistakes (or assumptions) you make in your code. The break cases are:
- Empty grid, n = 0 and m = 0
- It is valid to assume that N*M <= 1e6 as that is the input size. But you make further assumption that N <= 2e3 and M <= 2e3 which need not be true.
The interview problems do not give the constraints unless its very needed as you are forced to write very optimized or generic code. This is also the reason the penalty is comparatively low (5 minutes).
I have made the minor fix here and it passes.
Thank you for response and solution , due to non constraints i totally forgot empty matrix , finally ACed