PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Snowflake

Find Shortest Grid Path

Last updated: Apr 2, 2026

Quick Overview

This question evaluates a candidate's ability to implement and reason about grid-based shortest-path algorithms, covering graph traversal, state representation, and obstacle handling.

  • medium
  • Snowflake
  • Coding & Algorithms
  • Software Engineer

Find Shortest Grid Path

Company: Snowflake

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given an `m x n` grid where `0` represents an open cell and `1` represents a blocked cell. You are also given a start cell `(sr, sc)` and a target cell `(tr, tc)`. From any open cell, you may move one step up, down, left, or right, as long as the next cell is inside the grid and not blocked. Return the minimum number of moves required to reach the target from the start. If the target is unreachable, return `-1`. Follow-up: Describe how you could also solve the problem using recursive depth-first search with backtracking and memoization, and explain the tradeoffs compared with a breadth-first search approach.

Quick Answer: This question evaluates a candidate's ability to implement and reason about grid-based shortest-path algorithms, covering graph traversal, state representation, and obstacle handling.

Related Interview Questions

  • Implement a JSON Parser - Snowflake (hard)
  • Solve Matrix and Array Distance Problems - Snowflake (medium)
  • Solve Array Distance and Wiki Navigation - Snowflake (medium)
  • Implement Document Predicate APIs - Snowflake (medium)
  • Find Shortest Wiki Click Path - Snowflake (medium)
Snowflake logo
Snowflake
Feb 11, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
18
0

You are given an m x n grid where 0 represents an open cell and 1 represents a blocked cell. You are also given a start cell (sr, sc) and a target cell (tr, tc). From any open cell, you may move one step up, down, left, or right, as long as the next cell is inside the grid and not blocked.

Return the minimum number of moves required to reach the target from the start. If the target is unreachable, return -1.

Follow-up: Describe how you could also solve the problem using recursive depth-first search with backtracking and memoization, and explain the tradeoffs compared with a breadth-first search approach.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Snowflake•More Software Engineer•Snowflake Software Engineer•Snowflake Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.