← OYO questions

Minimum distance in a matrix with obstacles

Filed under OYO

Given an N x M matrix with empty cells '.', obstacles 'B', a start cell 'S', and a destination 'D', find the minimum distance from S to D. You can move up, down, left, or right. Return -1 if no path…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related OYO questions

Collected from public candidate posts and coding forums. Updated Nov 2026.