Hi all, I am having really hard time in solving hard problems. When do you solve problems tagged as hard in leetcode? Before onsite? It’s so fucking hard .. and making me hopeless.. numb at times. Could anyone suggest any strategy on how to tackle hard problems? I have not yet finished all medium problems. Shall I focus primarily on medium or both medium + hard to ensure success? Thanks!
Most hards are part of a question chain that builds up on a topic. Try starting at the easy one of the chain.
I understand what you mean. But check the problem Swim in rising water and its solution with binary search. Seemed crazy to me and felt like I am nowhere near to thinking right approach without hint. And the people who commented on solution!! Jeez .. Feeling stupid.
LC hard are supposed to be hard, it's normal that you struggle with them.
When it comes to hard problems, interviewer will usually give you an easier version to solve and ask you to improve based on that
If it’s any consolation, I’ve given LC hard and given a “Yes” when they did NOT get the optimal solution for L5
There are two categories of LC hard's: The ones that are actually managable and the ones that require you to have a certain piece of knowledge, like some fancy algorithm, or some fancy math formula. When I was prepping for my interviews I skipped all the ones from the second category and ended up doing quite well in the interviews. I don't think any respectable company would make you solve problems from that category. Generally my experience was that most companies only give you LC mediums and then some practical/experience stuff you can't really prepare for.
I was asked a leetcode hard for Microsoft that i never saw before. Somehow I managed to come up with a unique solution under 45 mins that the interviewer was satisfied and impressed with. I've done about 120 mediums and 30 hards. Keep grinding and you'll be surprised with what you're capable of when you're on the spot.
Thank you :)
Focus on easies and mediums. In general, you want to be able to solve LC Mediums in 20-30 min since they are usually followed up with a twist to make it harder. The twist is generally solvable with a few hints and feels like pair programming at times and should be a nice "discussion" of why the twist makes the problem harder and possible techniques/tradeoffs to solve them. Aside from AirBnB (from my experience), LC Hards are almost pair programming type questions where you are allowed a few hints to keep progressing. You're expected to progress somewhat or have a solution that nails an ideal case, but you should be able to progress to completion with the few hints. I think it's possible to due LC Hards like this if you know how to do LC Mediums pretty easily (30-40 min). It's very possible to get LC Hards in an interview (every onsite I get 1-2 LC Hards), but they are in the format I described above.
You all are amazing people on Blind. Thank you for your reply and sharing your experiences.
Only mediums are needed for success.
You’re living in the paast infosys
I’m basing my answer off the questions I got for Google onsite 2 weeks back, AWS today and a Verily onsite back in July. Also, off some OA’s/ phone interviews I have given for WeWork, C3.ai, Google, Verily and AWS. They’re fairly recent and I would say most questions I encountered were of medium difficulty. Not to say I didn’t encounter hards, but you also don’t need to ace every question for success.