CoolFace
Datasetpublic

FPEvalDataset/LeetCodeProblem

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes305downloads
1{2    "id": 3415,3    "name": "check_if_grid_satisfies_conditions",4    "difficulty": "Easy",5    "link": "https://leetcode.com/problems/check-if-grid-satisfies-conditions/",6    "date": "2024-04-27 00:00:00",7    "task_description": "You are given a 2D matrix `grid` of size `m x n`. You need to check if each cell `grid[i][j]` is: Equal to the cell below it, i.e. `grid[i][j] == grid[i + 1][j]` (if it exists). Different from the cell to its right, i.e. `grid[i][j] != grid[i][j + 1]` (if it exists). Return `true` if **all** the cells satisfy these conditions, otherwise, return `false`. **Example 1:** **Input:** grid = [[1,0,2],[1,0,2]] **Output:** true **Explanation:** **** All the cells in the grid satisfy the conditions. **Example 2:** **Input:** grid = [[1,1,1],[0,0,0]] **Output:** false **Explanation:** **** All cells in the first row are equal. **Example 3:** **Input:** grid = [[1],[2],[3]] **Output:** false **Explanation:** Cells in the first column have different values. **Constraints:** `1 <= n, m <= 10` `0 <= grid[i][j] <= 9`",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "grid = [[1,0,2],[1,0,2]]",12            "output": "true "13        },14        {15            "label": "Example 2",16            "input": "grid = [[1,1,1],[0,0,0]]",17            "output": "false "18        },19        {20            "label": "Example 3",21            "input": "grid = [[1],[2],[3]]",22            "output": "false "23        }24    ],25    "private_test_cases": [26        {27            "input": [28                [29                    7,30                    6,31                    4,32                    7,33                    1,34                    8,35                    9,36                    737                ],38                [39                    3,40                    8,41                    3,42                    5,43                    3,44                    7,45                    6,46                    647                ],48                [49                    3,50                    2,51                    7,52                    1,53                    3,54                    1,55                    1,56                    457                ],58                [59                    0,60                    2,61                    4,62                    9,63                    3,64                    1,65                    4,66                    567                ],68                [69                    0,70                    2,71                    9,72                    7,73                    5,74                    3,75                    4,76                    177                ],78                [79                    1,80                    5,81                    4,82                    4,83                    9,84                    6,85                    9,86                    387                ],88                [89                    2,90                    9,91                    8,92                    5,93                    3,94                    7,95                    2,96                    197                ],98                [99                    9,100                    4,101                    0,102                    6,103                    1,104                    7,105                    4,106                    1107                ],108                [109                    5,110                    9,111                    9,112                    6,113                    5,114                    6,115                    5,116                    8117                ],118                [119                    4,120                    0,121                    7,122                    1,123                    6,124                    2,125                    9,126                    7127                ]128            ],129            "output": false130        },131        {132            "input": [133                [134                    0,135                    9136                ],137                [138                    1,139                    5140                ],141                [142                    0,143                    1144                ],145                [146                    9,147                    9148                ],149                [150                    9,151                    7152                ],153                [154                    0,155                    0156                ],157                [158                    4,159                    6160                ],161                [162                    0,163                    8164                ],165                [166                    0,167                    9168                ]169            ],170            "output": false171        },172        {173            "input": [174                [175                    9,176                    8,177                    8,178                    3,179                    0,180                    8,181                    7,182                    9,183                    9,184                    4185                ],186                [187                    1,188                    9,189                    9,190                    0,191                    2,192                    9,193                    7,194                    1,195                    9,196                    9197                ],198                [199                    3,200                    0,201                    6,202                    8,203                    3,204                    6,205                    5,206                    0,207                    2,208                    0209                ],210                [211                    8,212                    1,213                    1,214                    7,215                    2,216                    2,217                    3,218                    1,219                    0,220                    8221                ],222                [223                    5,224                    4,225                    5,226                    5,227                    2,228                    7,229                    8,230                    6,231                    8,232                    2233                ],234                [235                    1,236                    0,237                    8,238                    8,239                    2,240                    1,241                    1,242                    4,243                    4,244                    6245                ]246            ],247            "output": false248        },249        {250            "input": [251                [252                    9,253                    8,254                    0,255                    7256                ],257                [258                    7,259                    8,260                    9,261                    4262                ],263                [264                    5,265                    1,266                    7,267                    6268                ],269                [270                    0,271                    2,272                    1,273                    3274                ],275                [276                    4,277                    1,278                    4,279                    7280                ],281                [282                    6,283                    4,284                    6,285                    0286                ],287                [288                    0,289                    8,290                    1,291                    3292                ],293                [294                    9,295                    5,296                    3,297                    8298                ]299            ],300            "output": false301        },302        {303            "input": [304                [305                    3306                ],307                [308                    1309                ],310                [311                    9312                ]313            ],314            "output": false315        }316    ],317    "haskell_template": "satisfiesConditions :: [[Int]] -> Bool\nsatisfiesConditions grid ",318    "ocaml_template": "let satisfiesConditions (grid: int list list) : bool =  ",319    "scala_template": "def satisfiesConditions(grid: List[List[Int]]): Boolean = { \n    \n}",320    "java_template": "class Solution {\n    public boolean satisfiesConditions(int[][] grid) {\n        \n    }\n}",321    "python_template": "class Solution(object):\n    def satisfiesConditions(self, grid):\n        \"\"\"\n        :type grid: List[List[int]]\n        :rtype: bool\n        \"\"\"\n        "322}