← Salesforce questions

BFS traversal on a matrix

Filed under Salesforce

Given a 2D grid of integers, perform a Breadth-First Search (BFS) starting from a given coordinate (r, c) to visit all reachable cells. Assume 4-directional movement (up, down, left, right) and that…

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 Salesforce questions

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