Since there is a high chance that FB gives problems straight out of leetcode, do we have to let the interviewer know we have seen the problem before? If not, do we give the optimal solution on the first attempt?
FB usually gives 2 problem, same as Amazon. 1 problem is easy (probably, just to make you comfortable) 1 med or hard (I got closest K points to origin)
Did you use quickselect or heap for it?
Amazon doesn’t give 2 problems. It’s 1 LC and 1 LP per round.
Fb asks problem straight out of LC. They know that you have seen the problem before. (If you haven't, you are probably being lazy.) The only time when you need to inform the interviewer is when you already got the same problem in a previous fb round. After they describe the problem, discuss the edge cases and all of the possible approaches quickly. When writing code, go straight for the optimal solution. The only problem with shooting for the optimal solution is that they are usually more complicated to implement. You might end up with bugs in your code.
Explain sub-optimal solution, then share observations you can use to optimize and the code.
Not all problems have suboptimal
ALL problems have suboptimal. What are you talking about? Any problem that can be solved in more than one way, must have one solution that's worse than the other
It looks so painful for devs to interview. I have not needed to prepare for a job interview since I was trying to get my first job out of school.
True. A broken system.
I did let 2 interviewers know I've seen the problems during on-sites so we'll see how it goes
They proceeded with the question?
One gave me a new one, haven't seen. Was able to work through it with hints, did feel like the interviewer wanted me to succeed. Got 2 done still in the session. The second interviewer was okay going through it, then proceeded with a problem I haven't seen on LC, possibly hard. This one might have been the dummy interview since I had 3 coding sessions and I hope so too, since I barely made a scratch on the second problem.
FYI I was given a question out of leetcode
Once I told my fb interviewer that I have seen the question before. He said solve it anyway. I stopped telling that for the following fb interviews. It doesn't seem like they care.
You asked 2 questions in one poll. Were you trying to optimize here? Don't do this in the interview.
Not to mention he provided 2 options instead of 4 🤣
I am still looking for those proud facebookers who said Facebook has banned a lot of LC recently and they are not asked anymore. I wonder, whether Facebook's intake quality has dropped significantly compared to google. I mean they are straight up promoting memorization and good LC memorizers will pass through for sure.
Lol. No. It’s likely that they’ll give you another LC problem. You need solid memorizing skills to get into fb.
So just give the optimal solution directly?
Yes.