CoolFace
Datasetpublic

TheRealSamuel/LeetCodeProblem

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes561downloads
1{2    "id": 3684,3    "name": "substring_matching_pattern",4    "difficulty": "Easy",5    "link": "https://leetcode.com/problems/substring-matching-pattern/",6    "date": "2024-12-21 00:00:00",7    "task_description": "You are given a string `s` and a pattern string `p`, where `p` contains **exactly one** `'*'` character. The `'*'` in `p` can be replaced with any sequence of zero or more characters. Return `true` if `p` can be made a substring of `s`, and `false` otherwise. **Example 1:** **Input:** s = \"leetcode\", p = \"ee*e\" **Output:** true **Explanation:** By replacing the `'*'` with `\"tcod\"`, the substring `\"eetcode\"` matches the pattern. **Example 2:** **Input:** s = \"car\", p = \"c*v\" **Output:** false **Explanation:** There is no substring matching the pattern. **Example 3:** **Input:** s = \"luck\", p = \"u*\" **Output:** true **Explanation:** The substrings `\"u\"`, `\"uc\"`, and `\"uck\"` match the pattern. **Constraints:** `1 <= s.length <= 50` `1 <= p.length <= 50 ` `s` contains only lowercase English letters. `p` contains only lowercase English letters and exactly one `'*'`",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "s = \"leetcode\", p = \"ee*e\"",12            "output": "true "13        },14        {15            "label": "Example 2",16            "input": "s = \"car\", p = \"c*v\"",17            "output": "false "18        },19        {20            "label": "Example 3",21            "input": "s = \"luck\", p = \"u*\"",22            "output": "true "23        }24    ],25    "private_test_cases": [26        {27            "input": [28                "\"fxdzelxekldposkfv\"",29                "\"w*x\""30            ],31            "output": false32        },33        {34            "input": [35                "\"hvjtouuxcdldxairxhizqhurxfjnc\"",36                "\"xcphgkzmwxhok*mkkxewgmivyzcdtnvxlwmrgjyhhqytnmxz\""37            ],38            "output": false39        },40        {41            "input": [42                "\"bki\"",43                "\"jagufqjls*qnqqre\""44            ],45            "output": false46        },47        {48            "input": [49                "\"yyyupshqyzgsfa\"",50                "\"z*n\""51            ],52            "output": false53        },54        {55            "input": [56                "\"riyqclmu\"",57                "\"mthvmft*ydlluorupgosnedafxlfxqksvtmnqnxbfirsub\""58            ],59            "output": false60        },61        {62            "input": [63                "\"elmfffsslfjkpgnybbbsqnunjkismthskalvtinapewrgzdeh\"",64                "\"kmoossfovnjypcvooyoh*avtizoqnsjgnfotafvna\""65            ],66            "output": false67        },68        {69            "input": [70                "\"bzaqnbowtpd\"",71                "\"fvpgxeaffhf*lw\""72            ],73            "output": false74        },75        {76            "input": [77                "rimhfsoufmvfcizxiffc",78                "aksewzfqhu*fappoonkskcnf"79            ],80            "output": false81        },82        {83            "input": [84                "cnsrxcazwpqzdyjen",85                "gcvmppytsum*qycyvtqjywpssuxbebphbzitfoudhsa"86            ],87            "output": false88        },89        {90            "input": [91                "aiiwkfntebwrtjhdycvnzcotjugkqmwsactkknmvvtsv",92                "i*"93            ],94            "output": true95        }96    ],97    "haskell_template": "hasMatch :: String -> String -> Bool\nhasMatch s p ",98    "ocaml_template": "let hasMatch (s: string) (p: string) : bool =  ",99    "scala_template": "def hasMatch(s: String,p: String): Boolean = { \n    \n}",100    "java_template": "class Solution {\n    public boolean hasMatch(String s, String p) {\n        \n    }\n}",101    "python_template": "class Solution(object):\n    def hasMatch(self, s, p):\n        \"\"\"\n        :type s: str\n        :type p: str\n        :rtype: bool\n        \"\"\"\n        "102}