I'd suggest always working on paper or whiteboard - never use a computer. (You have to emulate the environment) Set a timer for every problem. (1 hour max - aim for 45 minutes on medium/hard when starting out; lower it as you familiarize yourself with a subject) Start throwing data structures and algorithms at the problem (pattern matching them, basically). Solve it or don't. Learn something to take away from it. If you don't solve it, learn how to solve it, and where you were lacking. If you did solve it, be sure to check other solutions because sometimes yours is crap. Practice that thing you were lacking. (Needed to know BFS? Implement BFS from scratch 10 times using spaced repetition) If you're planning on 8 hour study sessions then focus on one type of problem at a time. (BFS, DFS, graph problems, tree problems, binary search, dynamic programming, etc.) Only do those kinds of problems in that session. Set it up like you would for a math class. You do one chapter in that session/day/week/whatever and proceed to do a few chapters (say a BFS chapter, a DFS chapter, and a binary search chapter)... Once you've done a few, give yourself a midterm covering the topics you learned. So give yourself like 2 DFS, 2 BFS, and 2 binary search problems and see if you can solve them in a timed environment. If you rocked the midterm then proceed on to do more chapters and more midterms. If you didn't then relearn those subjects before moving on. Finally, when you feel like you've learned everything then give yourself a final exam to see if you remember everything and can still do it right.
Basically - treat it like a math class. It's not just memorization (you need to memorize the strategies, that's for sure - you need to be really fast at implementing BFS, DFS, binary search, etc. That should be wrote memorization but with a deep understanding).
When I try to solve a problem I generally see the output needed and construct code to get the pattern with a lot of trail and error. I am not sure if I can scale with this. If I am fresh and in flow I can come up with good solutions. If not and I am nervous then I will have trouble solving something as simple as fibonacci.
I sometimes have trouble doing pattern matching where I get confused if the problem is changed slightly and is made tricky. I think this is because I am trying to be too specific with the match and not seeing a generic picture.
Can you suggest how a person with a job can practice so thoroughly? 8 hour sessions everyday is tough maybe on weekends but still is sometimes difficult.
In my case I find prepping really dry and like to work on personal projects and veer off to different technical things that I am curious in.
When I try to solve problems I hate to look at answers and I spend a lot of time sometimes days trying to solve it. What is your approach to solve problems?
Could you please elaborate on how you prepared to a person like me who is aspiring to take a FAANG interview?