Forget the Hunger Games, here is the dystopian shit right now:
For a medium level leetcode problem here is the time split (for which 20 min are given typically):
1. 4 min => Read/interpret/parse the problem statement
2. 5 min => Formulate the solution.
3. 8 min => Actual code
4. 3 min => Edge cases/review
---------------------
Notes:
* #2 You should think of various algos, DS and lock on to a particular one. If you cannot improve upon the time complexity, you need to make a split decision to either 1) continue to think more or 2) choose the next best and move to #3
* All you can do is steal one min from other phases but at the cost of less time in that phase.
* Think aloud in #2, #3 & #4
* At times even less time is available in case follow-up questions are to be accounted for.
* Code structure & consistency is important. You will be penalized if you write big monoliths.
* Additional conditions when GTFO is triggered: ["Solved the problem in 23 min instead of 20", "Did not think about that 1 scenario even though you took care of most of the important ones", "Solved the DP problem in top-down instead of bottom-up.. loser"]
----------------------
Optimizations:
* #3 should be reduced as much as possible. Choose a lang, know its standard lib by heart. This gives more time for #2
* Think of edge cases while writing code in #3
* At #2 one, you should be able to describe a solution (in your mind) detailed enough to convert into a code e.g Do DFS. Keep a max_val variable. Update max_val on values from left & right sub-tree.
* Develop intuition of doing some #2 work while in #1
-------------------------
What actually happens (or should happen) when someone practices leetcode a lot?
1. Reduce #1 time.
2. #2 => Quick recall of high level patterns already encountered
3. Able to generate multiple solutions.
4. #3 => Translate that pattern as fast as possible. E.g. There is a standard template for BFS, DFS, two pointers, etc
--------------------------
So the entire prep can be divided into two parts:
1. How soon you can zero-in a solution and convert into an outline?
2. How fast you can vomit that into a code?
Once you are comfortable in writing any code fast, you do not have to code every problem in leetcode. I see a problem and only solve it in mind and then check whether the approach was ok or not. I know I can code it fast
Edit: So for me if I have solved 200-300 LC problems, what it really means is I have actually coded in like 40-50 and remaining are just mind puzzles. If I do daily 5 mind solves, I can easily cover 200 in 40 days. I finish this daily routine in 30-45 min. (Hey .. I said this is dystopian)
------------------------
High level view:
* Practice incrementally and not in 2-3 months sprint. Think of it as daily exercise.
* This is just the way it is. May be I will do my part to change the system from inside when I am in an influential position. If you are able to find companies which do not do this shit, really good for you.
* Know that as senior dev, the margin for error is even less. So more important to practice incrementally.
--------------------------
I do not approve of this. Its bad. I am just a guy dealing with the "system".
For a medium level leetcode problem here is the time split (for which 20 min are given typically):
1. 4 min => Read/interpret/parse the problem statement
2. 5 min => Formulate the solution.
3. 8 min => Actual code
4. 3 min => Edge cases/review
---------------------
Notes:
* #2 You should think of various algos, DS and lock on to a particular one. If you cannot improve upon the time complexity, you need to make a split decision to either 1) continue to think more or 2) choose the next best and move to #3
* All you can do is steal one min from other phases but at the cost of less time in that phase.
* Think aloud in #2, #3 & #4
* At times even less time is available in case follow-up questions are to be accounted for.
* Code structure & consistency is important. You will be penalized if you write big monoliths.
* Additional conditions when GTFO is triggered: ["Solved the problem in 23 min instead of 20", "Did not think about that 1 scenario even though you took care of most of the important ones", "Solved the DP problem in top-down instead of bottom-up.. loser"]
----------------------
Optimizations:
* #3 should be reduced as much as possible. Choose a lang, know its standard lib by heart. This gives more time for #2
* Think of edge cases while writing code in #3
* At #2 one, you should be able to describe a solution (in your mind) detailed enough to convert into a code e.g Do DFS. Keep a max_val variable. Update max_val on values from left & right sub-tree.
* Develop intuition of doing some #2 work while in #1
-------------------------
What actually happens (or should happen) when someone practices leetcode a lot?
1. Reduce #1 time.
2. #2 => Quick recall of high level patterns already encountered
3. Able to generate multiple solutions.
4. #3 => Translate that pattern as fast as possible. E.g. There is a standard template for BFS, DFS, two pointers, etc
--------------------------
So the entire prep can be divided into two parts:
1. How soon you can zero-in a solution and convert into an outline?
2. How fast you can vomit that into a code?
Once you are comfortable in writing any code fast, you do not have to code every problem in leetcode. I see a problem and only solve it in mind and then check whether the approach was ok or not. I know I can code it fast
Edit: So for me if I have solved 200-300 LC problems, what it really means is I have actually coded in like 40-50 and remaining are just mind puzzles. If I do daily 5 mind solves, I can easily cover 200 in 40 days. I finish this daily routine in 30-45 min. (Hey .. I said this is dystopian)
------------------------
High level view:
* Practice incrementally and not in 2-3 months sprint. Think of it as daily exercise.
* This is just the way it is. May be I will do my part to change the system from inside when I am in an influential position. If you are able to find companies which do not do this shit, really good for you.
* Know that as senior dev, the margin for error is even less. So more important to practice incrementally.
--------------------------
I do not approve of this. Its bad. I am just a guy dealing with the "system".