Download append-characters-to-string-to-make-subsequence.json from FPEvalRepoPublic/LeetCodeMetaData: direct link, hf CLI and curl.
- Browser
- Download file 2.33 kB
-
https://huggingface.co/datasets/FPEvalRepoPublic/LeetCodeMetaData/resolve/main/append-characters-to-string-to-make-subsequence.json
- Command line
-
hf download hf://datasets/FPEvalRepoPublic/LeetCodeMetaData/append-characters-to-string-to-make-subsequence.json
-
curl -L -o append-characters-to-string-to-make-subsequence.json https://huggingface.co/datasets/FPEvalRepoPublic/LeetCodeMetaData/resolve/main/append-characters-to-string-to-make-subsequence.json
2.33 kB
| { | |
| "id": 2572, | |
| "name": "append-characters-to-string-to-make-subsequence", | |
| "difficulty": "Medium", | |
| "link": "https://leetcode.com/problems/append-characters-to-string-to-make-subsequence/", | |
| "date": "2022-11-20", | |
| "task_description": "You are given two strings `s` and `t` consisting of only lowercase English letters. Return _the minimum number of characters that need to be appended to the end of _`s`_ so that _`t`_ becomes a **subsequence** of _`s`. A **subsequence** is a string that can be derived from another string by deleting some or no characters without changing the order of the remaining characters. **Example 1:** ``` **Input:** s = \"coaching\", t = \"coding\" **Output:** 4 **Explanation:** Append the characters \"ding\" to the end of s so that s = \"coachingding\". Now, t is a subsequence of s (\"**co**aching**ding**\"). It can be shown that appending any 3 characters to the end of s will never make t a subsequence. ``` **Example 2:** ``` **Input:** s = \"abcde\", t = \"a\" **Output:** 0 **Explanation:** t is already a subsequence of s (\"**a**bcde\"). ``` **Example 3:** ``` **Input:** s = \"z\", t = \"abcde\" **Output:** 5 **Explanation:** Append the characters \"abcde\" to the end of s so that s = \"zabcde\". Now, t is a subsequence of s (\"z**abcde**\"). It can be shown that appending any 4 characters to the end of s will never make t a subsequence. ``` **Constraints:** `1 <= s.length, t.length <= 105` `s` and `t` consist only of lowercase English letters.", | |
| "test_case": [ | |
| { | |
| "label": "Example 1", | |
| "input": "s = \"coaching\", t = \"coding\"", | |
| "output": "4 " | |
| }, | |
| { | |
| "label": "Example 2", | |
| "input": "s = \"abcde\", t = \"a\"", | |
| "output": "0 " | |
| }, | |
| { | |
| "label": "Example 3", | |
| "input": "s = \"z\", t = \"abcde\"", | |
| "output": "5 " | |
| } | |
| ], | |
| "constraints": [ | |
| "1 <= s.length, t.length <= 105", | |
| "s and t consist only of lowercase English letters." | |
| ], | |
| "python_template": "class Solution(object):\n def appendCharacters(self, s, t):\n \"\"\"\n :type s: str\n :type t: str\n :rtype: int\n \"\"\"\n ", | |
| "java_template": "class Solution {\n public int appendCharacters(String s, String t) {\n \n }\n}", | |
| "metadata": { | |
| "func_name": "appendCharacters" | |
| } | |
| } |