-
Grind Leetcode mediums
-
REACTO strategy
- REPEAT THE QUESTION
- EXAMPLES - WRITE THEM OUT
- APPROACH - DESCRIBE IT
- CODE
- TEST
- OPTIMIZE
-
before coding: DO NOT CODE RIGHT AWAYYYY
- ask clarifying questions!!
- make sure you understand the examples
- what is the type of input? are there multiple inputs?
- what is the return type? is there one, are you printing? or both?
- arrays
- is it empty?
- how long can the array be?
- special cases when array is empty, 1-3 elements?
- what are the data types in the array?
- strings
- is it empty?
- uppercase or lowercase?
- length?
- any other special characteristics?
- numbers
- ints or floats?
- floor div or float div?
- can it be negative?
- special cases when negative, zero, positive, decimal?
- restate problem to ensure you’re on the same page
- pseudocode
- CONSIDER EDGE CASES
- write out examples input → output
-
Talk out loud at every step of your thought process
- even dumb ideas might be correct ideas
- why did you choose that particular data structure?
- why are you doing it that way?
-
Test your code!
- Doctests (if possible)
- Assert statements (while coding!!!)
- Run through 1-2 examples! Include edge cases!!!
-
Time complexity/how can you make it better?