Minimum Grid Moves
Updated
Problem statement
In a zero-and-one maze, move from the top-left cell to the bottom-right. A move travels between 1 and k cells horizontally or vertically, but it cannot cross or land on an obstacle. Return the minimum number of moves, or -1 if the destination is unreachable.
Function
getMinimumMoves(maze: int[][], k: int) → intExamples
Example 1
maze = [[0,0],[1,0]]k = 2return = 2Move right once and down once; the obstacle blocks the other route.
Constraints
1 <= rows, columns, k <= 100- Cells contain only
0or1.
More Atlassian Online Assessment questions
- Planning ProductionOA · Seen Feb 2025
- K-Means ClusteringOA · Seen Feb 2025
- Minimum Sorted Erasure OperationsOA · Seen Jun 2024
- Count Analogous ArraysOA · Seen Mar 2024
- Get Maximum ScoreOA · Seen Mar 2024
- Better Compression 🦀OA · Seen Mar 2024
- Romanizer 🐡OA · Seen Mar 2024
- Flower Bouquets 💐OA · Seen Mar 2024
- Binary Search Tree IteratorOA · Seen Nov 2023
- Binary Tree Level Order TraversalOA · Seen Nov 2023
Similar questions at other companies
- Minimize CommuteDatabricks · OA · PHONE SCREENDatabricks interview questions
- Shortest Atom Action PathOpenAI · OAOpenAI interview questions
- Minimum Cleaning Robot RunsHSBC · OAHSBC interview questions
- Count Islands with DFS and BFSVisa · OAVisa interview questions
- Number of IslandsGoldman Sachs · OA · PHONE SCREEN · ONSITE INTERVIEWGoldman Sachs interview questions
- Count One Groups by SizeAgoda · OAAgoda interview questions
- Ascend Vertical Wall (For off-campus 2025 batch hiring :)Uber · OAUber interview questions
- Grid ExplorationIMC Trading · OAIMC Trading interview questions
- Maximum Damage PatchGecko Robotics · OA · PHONE SCREEN
- Nearest Different Maze Exit for a SnakeIntuit · OAIntuit interview questions