Had a DD interview where I was asked LC 1235, max profit in job scheduling. I gave optimal solution to the question. Follow up was what if you could do K deliveries at a time. I gave a solution saying run the original solution K times but do it in a way where we do not consider intervals we’ve already chosen. Interviewer said this would never work…? He then says hold on the page for this question isn’t loading… so obviously he’s just reading from a script. He tells me he wanted 2D DP solution and my solution wouldn’t work. I got rejected in the end… come on. What is this? A guess what solution I have game? Lol They didn’t even try to work through my solution with me just kept saying it’s wrong and I can see they’re just laying in bed the whole interview …
I remember a similar experience with paytm. I wrote a solution with O(n) complexity for trapping the rain water problem. My solution had a while loop inside for loop and just looking at that interviewer said it’s O(n*n). The only reason why paytm stock dipped i guess.
If you ask trapping rain water youre a dick
Trash interviewer
obviously running the base solution k times is naive and not optimal which they wouldn't ask as follow up question if they were okay with that approach. Maybe the interview was checking if your approach is at least one of the minimal acceptable solutions.
The original solution is N + N log N + N * log N This would mean my solution is N + N log N + K * (N * log N) From what I see the 2D DP solution he wanted was N + N log N + N * N * K I never bothered making the solution he wanted after the interview but I guess it would depend on what’s bigger, N or K. Whatever they have as what they expect could be better than what I said but the interviewer didn’t even accept my solution as something that works. If he at least gave me a clue from my working follow-up solution on where to go, it could’ve been a better experience. Instead he just said wrong, then said something like “you should’ve done 2D DP but it’s too late now, next follow up” To me, 2D DP is not so intuitive to this problem. Maybe others have gotten it and passed, idk.
The way around this is to innovate and surpass their company with your own