Download check_distances_between_same_letters/meta.json from FPEvalRepoPublic/LeetCodeProblem: direct link, hf CLI and curl.
- Browser
- Download file 10.6 kB
-
https://huggingface.co/datasets/FPEvalRepoPublic/LeetCodeProblem/resolve/main/check_distances_between_same_letters/meta.json
- Command line
-
hf download hf://datasets/FPEvalRepoPublic/LeetCodeProblem/check_distances_between_same_letters/meta.json
-
curl -L -o meta.json https://huggingface.co/datasets/FPEvalRepoPublic/LeetCodeProblem/resolve/main/check_distances_between_same_letters/meta.json
10.6 kB
| { | |
| "id": 2476, | |
| "name": "check_distances_between_same_letters", | |
| "difficulty": "Easy", | |
| "link": "https://leetcode.com/problems/check-distances-between-same-letters/", | |
| "date": "1661644800000", | |
| "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`", | |
| "public_test_cases": [ | |
| { | |
| "label": "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 " | |
| }, | |
| { | |
| "label": "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 " | |
| } | |
| ], | |
| "private_test_cases": [ | |
| { | |
| "input": [ | |
| "\"ppqkargjvtumhlvtqagumlrkjh\"", | |
| [ | |
| -1, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| -1, | |
| -1, | |
| 0, | |
| -1, | |
| -1, | |
| -1, | |
| -1, | |
| 0, | |
| 0, | |
| -1, | |
| -1, | |
| -1, | |
| 0, | |
| -1, | |
| -1, | |
| -1, | |
| 0, | |
| 0, | |
| 0, | |
| 0 | |
| ] | |
| ], | |
| "output": true | |
| }, | |
| { | |
| "input": [ | |
| "\"sbkoxnxabigccaljjeiosgknel\"", | |
| [ | |
| -1, | |
| -1, | |
| -1, | |
| 0, | |
| -1, | |
| 0, | |
| -1, | |
| 0, | |
| -1, | |
| -1, | |
| -1, | |
| -1, | |
| 0, | |
| -1, | |
| -1, | |
| 0, | |
| 0, | |
| 0, | |
| -1, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| -1, | |
| 0, | |
| 0 | |
| ] | |
| ], | |
| "output": true | |
| }, | |
| { | |
| "input": [ | |
| "\"agymhjaxnjxvnveiyefhgfccmi\"", | |
| [ | |
| -1, | |
| 0, | |
| -1, | |
| 0, | |
| -1, | |
| -1, | |
| -1, | |
| -1, | |
| -1, | |
| -1, | |
| 0, | |
| 0, | |
| -1, | |
| -1, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| -1, | |
| 0, | |
| -1, | |
| -1, | |
| 0 | |
| ] | |
| ], | |
| "output": true | |
| }, | |
| { | |
| "input": [ | |
| "\"blbkmlimqnuddeqjjfefknisus\"", | |
| [ | |
| 0, | |
| -1, | |
| 0, | |
| -1, | |
| -1, | |
| -1, | |
| 0, | |
| 0, | |
| -1, | |
| -1, | |
| -1, | |
| -1, | |
| -1, | |
| -1, | |
| 0, | |
| 0, | |
| -1, | |
| 0, | |
| -1, | |
| 0, | |
| -1, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| 0 | |
| ] | |
| ], | |
| "output": true | |
| }, | |
| { | |
| "input": [ | |
| "\"dwdnqujjmrzcquprwcipznttim\"", | |
| [ | |
| 0, | |
| 0, | |
| -1, | |
| -1, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| -1, | |
| -1, | |
| 0, | |
| 0, | |
| -1, | |
| -1, | |
| 0, | |
| -1, | |
| -1, | |
| -1, | |
| 0, | |
| -1, | |
| -1, | |
| 0, | |
| -1, | |
| 0, | |
| 0, | |
| -1 | |
| ] | |
| ], | |
| "output": true | |
| }, | |
| { | |
| "input": [ | |
| "\"gcbgmcpfqvmqlvbottzaplzofa\"", | |
| [ | |
| -1, | |
| -1, | |
| -1, | |
| 0, | |
| 0, | |
| -1, | |
| -1, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| -1, | |
| -1, | |
| 0, | |
| -1, | |
| -1, | |
| -1, | |
| 0, | |
| 0, | |
| -1, | |
| 0, | |
| -1, | |
| 0, | |
| 0, | |
| 0, | |
| -1 | |
| ] | |
| ], | |
| "output": true | |
| }, | |
| { | |
| "input": [ | |
| "\"nocmzrbdbtmekkfofdzncrtlle\"", | |
| [ | |
| 0, | |
| -1, | |
| -1, | |
| -1, | |
| -1, | |
| -1, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| -1, | |
| -1, | |
| -1, | |
| -1, | |
| -1, | |
| 0, | |
| 0, | |
| -1, | |
| 0, | |
| -1, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| -1 | |
| ] | |
| ], | |
| "output": true | |
| }, | |
| { | |
| "input": [ | |
| "gdqcfafcbtivuruibvytqyrgda", | |
| [ | |
| -1, | |
| -1, | |
| -1, | |
| -1, | |
| 0, | |
| -1, | |
| -1, | |
| 0, | |
| -1, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| -1, | |
| -1, | |
| 0, | |
| -1, | |
| -1, | |
| -1, | |
| 0, | |
| 0, | |
| -1, | |
| 0 | |
| ] | |
| ], | |
| "output": true | |
| }, | |
| { | |
| "input": [ | |
| "pjgwlwmedffnalaykngkjpymed", | |
| [ | |
| -1, | |
| 0, | |
| 0, | |
| -1, | |
| -1, | |
| -1, | |
| -1, | |
| 0, | |
| 0, | |
| -1, | |
| -1, | |
| -1, | |
| -1, | |
| -1, | |
| 0, | |
| -1, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| 0, | |
| -1, | |
| 0, | |
| -1, | |
| 0 | |
| ] | |
| ], | |
| "output": true | |
| }, | |
| { | |
| "input": [ | |
| "ddvfvcyizunfpiypuslcrrlnzs", | |
| [ | |
| 0, | |
| 0, | |
| -1, | |
| -1, | |
| 0, | |
| -1, | |
| 0, | |
| 0, | |
| -1, | |
| 0, | |
| 0, | |
| -1, | |
| 0, | |
| -1, | |
| 0, | |
| -1, | |
| 0, | |
| -1, | |
| -1, | |
| 0, | |
| -1, | |
| -1, | |
| 0, | |
| 0, | |
| -1, | |
| -1 | |
| ] | |
| ], | |
| "output": true | |
| } | |
| ], | |
| "haskell_template": "checkDistances :: String -> [Int] -> Bool\ncheckDistances s distance ", | |
| "ocaml_template": "let checkDistances (s: string) (distance: int list) : bool = ", | |
| "scala_template": "def checkDistances(s: String,distance: List[Int]): Boolean = { \n \n}", | |
| "java_template": "public static boolean checkDistances(String s, List<Integer> distance) {\n\n}", | |
| "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 " | |
| } |