0 Tips - Teeeeeebag/LeetCode GitHub Wiki

  1. Before starting coding, try all the corner cases first. Corner cases may change the whole or part of the implementation. And if you failed to take all the cases into consideration, you will be very likely fail the interview. So all your work are wasted even you can get the main algorithm right very fast.
    • For example, when solving Recover Binary Search Tree, I didn't take the case where two connecting tree node are swapped. And assume that two nodes are not connected or only consider the most common case where two nodes are not connected. Then that implement does not work for the corner case and cannot be easily changed to take the corner case into consideration.