Team Ai
Datasetpublic

FPEvalRepoPublic/LeetCodeMetaData

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes399downloads
find-the-encrypted-string.json35 linesDownload Raw Back to root
1{2  "id": 3468,3  "name": "find-the-encrypted-string",4  "difficulty": "Easy",5  "link": "https://leetcode.com/problems/find-the-encrypted-string/",6  "date": "2024-06-30",7  "task_description": "You are given a string `s` and an integer `k`. Encrypt the string using the following algorithm: For each character `c` in `s`, replace `c` with the `kth` character after `c` in the string (in a cyclic manner). Return the _encrypted string_. **Example 1:** **Input:** s = \"dart\", k = 3 **Output:** \"tdar\" **Explanation:** For `i = 0`, the 3rd character after `'d'` is `'t'`. For `i = 1`, the 3rd character after `'a'` is `'d'`. For `i = 2`, the 3rd character after `'r'` is `'a'`. For `i = 3`, the 3rd character after `'t'` is `'r'`. **Example 2:** **Input:** s = \"aaa\", k = 1 **Output:** \"aaa\" **Explanation:** As all the characters are the same, the encrypted string will also be the same. **Constraints:** `1 <= s.length <= 100` `1 <= k <= 104` `s` consists only of lowercase English letters.",8  "test_case": [9    {10      "label": "Example 1",11      "input": "s = \"dart\", k = 3",12      "output": "\"tdar\" "13    },14    {15      "label": "Example 2",16      "input": "s = \"aaa\", k = 1",17      "output": "\"aaa\" "18    }19  ],20  "constraints": [21    "For each character c in s, replace c with the kth character after c in the string (in a cyclic manner).",22    "For i = 0, the 3rd character after 'd' is 't'.",23    "For i = 1, the 3rd character after 'a' is 'd'.",24    "For i = 2, the 3rd character after 'r' is 'a'.",25    "For i = 3, the 3rd character after 't' is 'r'.",26    "1 <= s.length <= 100",27    "1 <= k <= 104",28    "s consists only of lowercase English letters."29  ],30  "python_template": "class Solution(object):\n    def getEncryptedString(self, s, k):\n        \"\"\"\n        :type s: str\n        :type k: int\n        :rtype: str\n        \"\"\"\n        ",31  "java_template": "class Solution {\n    public String getEncryptedString(String s, int k) {\n        \n    }\n}",32  "metadata": {33    "func_name": "getEncryptedString"34  }35}