I am new to interviewbit . many times I feel I my code is correct but I see some test case got failed . How to debug the code here itself .
Use Test with Custom input whenever your code fails in any of the test case and then put print statements to debug your code. Also, you can use See expected output option to see if your understanding of test case is aligned with what is asked in the question.
@ pawandeep2155 is correct however I would like to add more.
- Insert print statements at several checkpoints in your code(avoid printing in next line in InterviewBit IDEs).
- If you have functions in your code then separately check(or print) every function’s output for corner cases.
- Grab a pen and paper and dry run a failing test case and match intermediate results with what your function is operating on.