🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Approaching DSA Interview Problems: all 10 questions

Quiz: Approaching DSA Interview Problems · Question 7 of 10

"Find the fewest moves in a grid where every move costs the same." Which algorithm fits?

"Find the fewest moves in a grid where every move costs the same." Which algorithm fits?

  1. A.BFS
  2. B.Heap sort
  3. C.Kadane's algorithm
  4. D.Binary search on the answer
Answer & explanation

Correct answer: BFS

BFS visits cells in order of distance when all edges have equal cost.

Can you get the rest right without peeking?

Take the timed Quiz: Approaching DSA Interview Problems quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →