The "Hidden" Checklist I Use Before Clicking Submit on LeetCode (Saves Tons of Penalties)

Hey everyone,

When I first started LeetCoding, I had a terrible habit: I would write out my logic, immediately hit the "Submit" button, and then get frustrated by a "Wrong Answer" or "Time Limit Exceeded" error.

Over time, I realized that top competitive programmers rarely do this. They have a mental checklist they run through before submitting. I compiled my own checklist, and it has drastically reduced my submission errors and helped me think like a real interviewer is watching.

Here is the checklist I use now:

1. The "Zero and One" Constraints

Before writing code, check the constraints at the bottom of the problem.

  • What if the input array/string is completely empty [] or ""?
  • What if it contains exactly one element?
  • Does your code throw a NullPointerException or out-of-bounds error on these?

2. The Negative and Maximum Extremes

  • If the problem involves integers, can they be negative? (e.g., Binary Search mid-point logic).
  • Can the cumulative sum exceed the 32-bit integer limit? If yes, are you casting your variables to long (Java/C++) to prevent overflow?

3. Dry-Running the "Mismatched" Case

  • Don't just test your code on the happy path examples given in the description.
  • Manually step through a test case where the answer should be false, -1, or empty. Make sure your loops exit correctly and don't get stuck infinitely.

4. Space Complexity Honest Check

  • Did you use a recursive function? Remember that the recursion stack takes up or memory.
  • Many people claim space in discussions while completely ignoring the system call stack!

What about you guys? Is there a specific edge case or rule you always check before hitting that submit button? Let’s build a master checklist in the comments!

Comments (2)