FPEvalDataset/LeetCodeProblem
0305
1{2 "id": 2375,3 "name": "minimum_obstacle_removal_to_reach_corner",4 "difficulty": "Hard",5 "link": "https://leetcode.com/problems/minimum-obstacle-removal-to-reach-corner/",6 "date": "2022-05-22 00:00:00",7 "task_description": "You are given a **0-indexed** 2D integer array `grid` of size `m x n`. Each cell has one of two values: `0` represents an **empty** cell, `1` represents an **obstacle** that may be removed. You can move up, down, left, or right from and to an empty cell. Return _the **minimum** number of **obstacles** to **remove** so you can move from the upper left corner _`(0, 0)`_ to the lower right corner _`(m - 1, n - 1)`. **Example 1:** ``` **Input:** grid = [[0,1,1],[1,1,0],[1,1,0]] **Output:** 2 **Explanation:** We can remove the obstacles at (0, 1) and (0, 2) to create a path from (0, 0) to (2, 2). It can be shown that we need to remove at least 2 obstacles, so we return 2. Note that there may be other ways to remove 2 obstacles to create a path. ``` **Example 2:** ``` **Input:** grid = [[0,1,0,0,0],[0,1,0,1,0],[0,0,0,1,0]] **Output:** 0 **Explanation:** We can move from (0, 0) to (2, 4) without removing any obstacles, so we return 0. ``` **Constraints:** `m == grid.length` `n == grid[i].length` `1 <= m, n <= 105` `2 <= m * n <= 105` `grid[i][j]` is either `0` **or** `1`. `grid[0][0] == grid[m - 1][n - 1] == 0`",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "grid = [[0,1,1],[1,1,0],[1,1,0]]",12 "output": "2 "13 },14 {15 "label": "Example 2",16 "input": "grid = [[0,1,0,0,0],[0,1,0,1,0],[0,0,0,1,0]]",17 "output": "0 "18 }19 ],20 "private_test_cases": [21 {22 "input": [23 [24 0,25 0,26 0,27 0,28 029 ]30 ],31 "output": 032 },33 {34 "input": [35 [36 037 ],38 [39 040 ],41 [42 043 ],44 [45 046 ],47 [48 049 ],50 [51 052 ],53 [54 055 ],56 [57 058 ]59 ],60 "output": 061 },62 {63 "input": [64 [65 0,66 0,67 0,68 0,69 0,70 0,71 0,72 0,73 0,74 075 ],76 [77 0,78 1,79 1,80 0,81 0,82 0,83 0,84 0,85 0,86 087 ],88 [89 0,90 0,91 0,92 0,93 0,94 0,95 0,96 1,97 0,98 199 ],100 [101 0,102 0,103 0,104 0,105 1,106 0,107 1,108 1,109 1,110 0111 ],112 [113 0,114 1,115 1,116 0,117 0,118 0,119 0,120 0,121 1,122 0123 ],124 [125 0,126 0,127 1,128 1,129 1,130 1,131 1,132 0,133 0,134 0135 ],136 [137 0,138 1,139 1,140 0,141 1,142 0,143 1,144 1,145 1,146 0147 ],148 [149 0,150 1,151 0,152 0,153 0,154 0,155 1,156 0,157 1,158 0159 ]160 ],161 "output": 0162 },163 {164 "input": [165 [166 0,167 0,168 0,169 0,170 0,171 0,172 0,173 0,174 0,175 0176 ],177 [178 0,179 1,180 1,181 0,182 1,183 0,184 1,185 0,186 0,187 0188 ]189 ],190 "output": 0191 },192 {193 "input": [194 [195 0,196 0,197 0,198 0,199 0200 ]201 ],202 "output": 0203 }204 ],205 "haskell_template": "minimumObstacles :: [[Int]] -> Int\nminimumObstacles grid ",206 "ocaml_template": "let minimumObstacles (grid: int list list) : int = ",207 "scala_template": "def minimumObstacles(grid: List[List[Int]]): Int = { \n \n}",208 "java_template": "class Solution {\n public int minimumObstacles(int[][] grid) {\n \n }\n}",209 "python_template": "class Solution(object):\n def minimumObstacles(self, grid):\n \"\"\"\n :type grid: List[List[int]]\n :rtype: int\n \"\"\"\n "210}