Hi all, Kindly share your insights on how do you debug the program(WA, TLE, App Crash). It will be really useful for us when we got stuck in solving a problem.
For WA and RTE, I will think of some corner cases and also check with small cases manually.
- Explain your answer to a rubber duck. Some times you may find something helpful in this process.
- Try to break your code. (Some input that can cause variable overflow, divide by zero, infinite loop etc).
- Prepare worst case input, corner case input etc.
- Write an automated test case generator and if possible a checker. Now write a script that pipes the output of generator to a file. This file should be fed to your solution and checker and output of your solution should be piped to checker. Let it run unless your solution fails.
- If it is possible to prepare exhaustive test cases, generate all of them and test them.
- Output intermediate values for test cases and validate them.
- In case of crash, debug your code at the place of crash.