Hey guys, I usually face difficulties when approaching completely new problem and get stuck eventually. For eg. https://leetcode.com/problems/maximal-rectangle/description/ My thought process looking at this problem: - hmm dfs? - but how do I track equal bounds on opposite side? - maybe dfs does not work after all.. - oh maybe first store all locations of “1” in a hashmap with index. In next iteration, start from valid “1” location then check 4 directions with continuous “1” until we encounter “0”. Distance would be relative from starting position. - hmm but how do I keep track of equal bounds.. After some time I literally freeze and give up. How do you run algorithms in your mind efficiently? I have good grasp on all popular algorithms, but I have issues in correctly choosing and applying them on a never seen problem. What does your thought process look like when you see this kind of problem? I have facebook onsite coming up in 2 weeks. Please help. :)
read the answer and memorize it. try to reduce the number of the "never seen questions" is the most efficient way for the interview.
This actually works. I have started keeping notes using “anki” as well.
I strongly disagree with this strategy. Memorization does not scale one you do 500+ questions. Focus on improving your problem solving skills not memorizing.
^This. (And then you take their site down when the problem is outside of your “knowledge”)
I think for Facebook you need to memorize and practice a lot. And lot depends on luck. I honestly feel they’re are very few intelligent ppl who can solve any problem at any time rest all are mug heads and also depends on luck !! Those very few intelligent ppl will be working for confidential projects at MSR or something better
You should know largest histogram in an array to solve this one
Yeah, I saw this problem, and realized it can be used using the largest rectangle in histogram, then I want on to solve that problem and came back to solve this one using that.
I solved this question at an onsite by reducing it to the “largest rectangle in a histogram” problem.
So if you didn’t know largest rectangle in histogram problem, do you think you would have still solved it? Thanks! P.s. is your nickname reference to Zerg SC player?
It is Jaedong himself.
I have similar issues. I think it's all about practice and intuition. I also want to hear what others have to say.