I was asked the following question recently in my first phone screen
Given N platforms and M ladders find if Mario can reach princess.
Platform is repsented by (X,Y) corodinate pair
Ladder is represented by (p1,p2) which means you need a ladder to go from p1->p2
There are 2 ways to reach from p1-p2
Mario is one platform and Princess is on another platform, so find if there is way for Mario to reach princess
I proposed a solution with BFS as follows
I felt this is a general BFS problem, interviewer said yes it can be solved using BFS he asked some
questions on optmizing i said we need not find all platforms for each node everytime but can precompute it but i didnt have much time to discuss about optmizations
Not sure what is wrong i got a reject. I am trying hard to understand how these FAANG companies evaluate candidates.I agree there might be some optmization possible here but this is my first phone screen so i thought i would be called for a next phone screen if not onsite directly but i got a straight reject. Is something wrong in this approach? And companies does not provide feedback at all so dont understand where did i go wrong. I am getting little frustrated with the rejects