Team Ai
Datasetpublic

FPEvalRepoPublic/LeetCodeMetaData

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes399downloads
count-palindromic-subsequences.json36 linesDownload Raw Back to root
1{2  "id": 2577,3  "name": "count-palindromic-subsequences",4  "difficulty": "Hard",5  "link": "https://leetcode.com/problems/count-palindromic-subsequences/",6  "date": "2022-11-12",7  "task_description": "Given a string of digits `s`, return _the number of **palindromic subsequences** of_ `s`_ having length _`5`. Since the answer may be very large, return it **modulo** `109 + 7`. **Note:** A string is **palindromic** if it reads the same forward and backward. 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 = \"103301\" **Output:** 2 **Explanation:** There are 6 possible subsequences of length 5: \"10330\",\"10331\",\"10301\",\"10301\",\"13301\",\"03301\". Two of them (both equal to \"10301\") are palindromic. ``` **Example 2:** ``` **Input:** s = \"0000000\" **Output:** 21 **Explanation:** All 21 subsequences are \"00000\", which is palindromic. ``` **Example 3:** ``` **Input:** s = \"9999900000\" **Output:** 2 **Explanation:** The only two palindromic subsequences are \"99999\" and \"00000\". ``` **Constraints:** `1 <= s.length <= 104` `s` consists of digits.",8  "test_case": [9    {10      "label": "Example 1",11      "input": "s = \"103301\"",12      "output": "2 "13    },14    {15      "label": "Example 2",16      "input": "s = \"0000000\"",17      "output": "21 "18    },19    {20      "label": "Example 3",21      "input": "s = \"9999900000\"",22      "output": "2 "23    }24  ],25  "constraints": [26    "A string is palindromic if it reads the same forward and backward.",27    "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.",28    "1 <= s.length <= 104",29    "s consists of digits."30  ],31  "python_template": "class Solution(object):\n    def countPalindromes(self, s):\n        \"\"\"\n        :type s: str\n        :rtype: int\n        \"\"\"\n        ",32  "java_template": "class Solution {\n    public int countPalindromes(String s) {\n        \n    }\n}",33  "metadata": {34    "func_name": "countPalindromes"35  }36}