CoolFace
Datasetpublic

FPEvalDataset/LeetCodeProblem

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes304downloads
1{2    "id": 2476,3    "name": "check_distances_between_same_letters",4    "difficulty": "Easy",5    "link": "https://leetcode.com/problems/check-distances-between-same-letters/",6    "date": "1661644800000",7    "task_description": "You are given a **0-indexed** string `s` consisting of only lowercase English letters, where each letter in `s` appears **exactly** **twice**. You are also given a **0-indexed** integer array `distance` of length `26`. Each letter in the alphabet is numbered from `0` to `25` (i.e. `'a' -> 0`, `'b' -> 1`, `'c' -> 2`, ... , `'z' -> 25`). In a **well-spaced** string, the number of letters between the two occurrences of the `ith` letter is `distance[i]`. If the `ith` letter does not appear in `s`, then `distance[i]` can be **ignored**. Return `true`_ if _`s`_ is a **well-spaced** string, otherwise return _`false`. **Example 1:** ``` **Input:** s = \"abaccb\", distance = [1,3,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] **Output:** true **Explanation:** - 'a' appears at indices 0 and 2 so it satisfies distance[0] = 1. - 'b' appears at indices 1 and 5 so it satisfies distance[1] = 3. - 'c' appears at indices 3 and 4 so it satisfies distance[2] = 0. Note that distance[3] = 5, but since 'd' does not appear in s, it can be ignored. Return true because s is a well-spaced string. ``` **Example 2:** ``` **Input:** s = \"aa\", distance = [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] **Output:** false **Explanation:** - 'a' appears at indices 0 and 1 so there are zero letters between them. Because distance[0] = 1, s is not a well-spaced string. ``` **Constraints:** `2 <= s.length <= 52` `s` consists only of lowercase English letters. Each letter appears in `s` exactly twice. `distance.length == 26` `0 <= distance[i] <= 50`",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "s = \"abaccb\", distance = [1,3,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]",12            "output": "true "13        },14        {15            "label": "Example 2",16            "input": "s = \"aa\", distance = [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]",17            "output": "false "18        }19    ],20    "private_test_cases": [21        {22            "input": [23                "\"ppqkargjvtumhlvtqagumlrkjh\"",24                [25                    -1,26                    0,27                    0,28                    0,29                    0,30                    0,31                    -1,32                    -1,33                    0,34                    -1,35                    -1,36                    -1,37                    -1,38                    0,39                    0,40                    -1,41                    -1,42                    -1,43                    0,44                    -1,45                    -1,46                    -1,47                    0,48                    0,49                    0,50                    051                ]52            ],53            "output": true54        },55        {56            "input": [57                "\"sbkoxnxabigccaljjeiosgknel\"",58                [59                    -1,60                    -1,61                    -1,62                    0,63                    -1,64                    0,65                    -1,66                    0,67                    -1,68                    -1,69                    -1,70                    -1,71                    0,72                    -1,73                    -1,74                    0,75                    0,76                    0,77                    -1,78                    0,79                    0,80                    0,81                    0,82                    -1,83                    0,84                    085                ]86            ],87            "output": true88        },89        {90            "input": [91                "\"agymhjaxnjxvnveiyefhgfccmi\"",92                [93                    -1,94                    0,95                    -1,96                    0,97                    -1,98                    -1,99                    -1,100                    -1,101                    -1,102                    -1,103                    0,104                    0,105                    -1,106                    -1,107                    0,108                    0,109                    0,110                    0,111                    0,112                    0,113                    0,114                    -1,115                    0,116                    -1,117                    -1,118                    0119                ]120            ],121            "output": true122        },123        {124            "input": [125                "\"blbkmlimqnuddeqjjfefknisus\"",126                [127                    0,128                    -1,129                    0,130                    -1,131                    -1,132                    -1,133                    0,134                    0,135                    -1,136                    -1,137                    -1,138                    -1,139                    -1,140                    -1,141                    0,142                    0,143                    -1,144                    0,145                    -1,146                    0,147                    -1,148                    0,149                    0,150                    0,151                    0,152                    0153                ]154            ],155            "output": true156        },157        {158            "input": [159                "\"dwdnqujjmrzcquprwcipznttim\"",160                [161                    0,162                    0,163                    -1,164                    -1,165                    0,166                    0,167                    0,168                    0,169                    -1,170                    -1,171                    0,172                    0,173                    -1,174                    -1,175                    0,176                    -1,177                    -1,178                    -1,179                    0,180                    -1,181                    -1,182                    0,183                    -1,184                    0,185                    0,186                    -1187                ]188            ],189            "output": true190        },191        {192            "input": [193                "\"gcbgmcpfqvmqlvbottzaplzofa\"",194                [195                    -1,196                    -1,197                    -1,198                    0,199                    0,200                    -1,201                    -1,202                    0,203                    0,204                    0,205                    0,206                    -1,207                    -1,208                    0,209                    -1,210                    -1,211                    -1,212                    0,213                    0,214                    -1,215                    0,216                    -1,217                    0,218                    0,219                    0,220                    -1221                ]222            ],223            "output": true224        },225        {226            "input": [227                "\"nocmzrbdbtmekkfofdzncrtlle\"",228                [229                    0,230                    -1,231                    -1,232                    -1,233                    -1,234                    -1,235                    0,236                    0,237                    0,238                    0,239                    -1,240                    -1,241                    -1,242                    -1,243                    -1,244                    0,245                    0,246                    -1,247                    0,248                    -1,249                    0,250                    0,251                    0,252                    0,253                    0,254                    -1255                ]256            ],257            "output": true258        },259        {260            "input": [261                "gdqcfafcbtivuruibvytqyrgda",262                [263                    -1,264                    -1,265                    -1,266                    -1,267                    0,268                    -1,269                    -1,270                    0,271                    -1,272                    0,273                    0,274                    0,275                    0,276                    0,277                    0,278                    0,279                    -1,280                    -1,281                    0,282                    -1,283                    -1,284                    -1,285                    0,286                    0,287                    -1,288                    0289                ]290            ],291            "output": true292        },293        {294            "input": [295                "pjgwlwmedffnalaykngkjpymed",296                [297                    -1,298                    0,299                    0,300                    -1,301                    -1,302                    -1,303                    -1,304                    0,305                    0,306                    -1,307                    -1,308                    -1,309                    -1,310                    -1,311                    0,312                    -1,313                    0,314                    0,315                    0,316                    0,317                    0,318                    0,319                    -1,320                    0,321                    -1,322                    0323                ]324            ],325            "output": true326        },327        {328            "input": [329                "ddvfvcyizunfpiypuslcrrlnzs",330                [331                    0,332                    0,333                    -1,334                    -1,335                    0,336                    -1,337                    0,338                    0,339                    -1,340                    0,341                    0,342                    -1,343                    0,344                    -1,345                    0,346                    -1,347                    0,348                    -1,349                    -1,350                    0,351                    -1,352                    -1,353                    0,354                    0,355                    -1,356                    -1357                ]358            ],359            "output": true360        }361    ],362    "haskell_template": "checkDistances :: String -> [Int] -> Bool\ncheckDistances s distance ",363    "ocaml_template": "let checkDistances (s: string) (distance: int list) : bool =  ",364    "scala_template": "def checkDistances(s: String,distance: List[Int]): Boolean = { \n    \n}",365    "java_template": "public static boolean checkDistances(String s, List<Integer> distance) {\n\n}",366    "python_template": "class Solution(object):\n    def checkDistances(self, s, distance):\n        \"\"\"\n        :type s: str\n        :type distance: List[int]\n        :rtype: bool\n        \"\"\"\n        "367}