Minimum Rollout Steps Across a Repairable Grid

A release pipeline travels across a platform team's service mesh, laid out as an m x n grid of nodes. Every node is either healthy (0) or crashed (1). The rollout starts at the top-left node (0, 0) and must land on the bottom-right node (m - 1, n - 1). From its current node the pipeline moves exactly one hop per step, to the neighbor directly above, below, left, or right. A crashed node refuses traffic until it is repaired: hopping into a crashed node consumes one of the k repair credits the pipeline carries, while hopping into a healthy node consumes none. The start and the destination follow the same rule, so if either endpoint is crashed the repair happens on arrival and spends one credit. Given grid and the credit budget k, return the minimum number of hops needed for the rollout to reach the bottom-right node, or -1 when no affordable route exists.

Examples
Input: [[[0,0,0],[1,1,0],[0,0,0]],1]
Output: 4
Hints

Minimum Rollout Steps Across a Repairable Grid

A release pipeline travels across a platform team's service mesh, laid out as an `m x n` grid of nodes. Every node is either healthy (`0`) or crashed (`1`). The rollout starts at the top-left node `(0, 0)` and must land on the bottom-right node `(m - 1, n - 1)`. From its current node the pipeline moves exactly one hop per step, to the neighbor directly above, below, left, or right. A crashed node refuses traffic until it is repaired: hopping into a crashed node consumes one of the `k` repair credits the pipeline carries, while hopping into a healthy node consumes none. The start and the destination follow the same rule, so if either endpoint is crashed the repair happens on arrival and spends one credit. Given `grid` and the credit budget `k`, return the minimum number of hops needed for the rollout to reach the bottom-right node, or `-1` when no affordable route exists.