← Amazon questions

Ways to cross grid border in exactly k steps

Filed under Amazon

Given an M x N grid and a starting position (X, Y), return the number of distinct paths that move off the grid boundary in exactly k steps. You can move up, down, left, or right at each step. Return…

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

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