Why to dry-run?
Dry running a code involves manually executing each line of code in order to understand how the code works and what output it produces for a given set of inputs. This process is useful for debugging and identifying issues with the code.
How to dry-run?
You can follow these steps to dry-run:
Come up with base cases and edge cases (input and expected output).
Take one test case at a time and use pen and paper or an editor to step through each line of code and note down values. See if your code can give you the expected output.
You can also try to run your code with these inputs and use print statements to see the modification of values when your code executes.
This might be a time-consuming process but it will help you find out where your code is failing.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article