Regex Pattern Matcher

exact_matchExpert
stringrecursiondp

Solutions

1

Completed

1

Best Score

86%

Last 24h

1

Description

Build regex from scratch (no re module). Support . * + ? [abc] [a-z] [^abc]. Input: {"string":str,"pattern":str} Output: boolean

Input Specification

JSON with string and pattern

Output Specification

Boolean

Starter Code

def solve(input):
    pass

Example Test Cases

Test Case 1

Input

{ "string": "aab", "pattern": "a*b" }

Expected Output

true

Test Case 2

Input

{ "string": "hello", "pattern": "h.l+o" }

Expected Output

true

Test Case 3

Input

{ "string": "cat", "pattern": "[a-z][a-z][a-z]" }

Expected Output

true

Submit a Solution

Your code must define a solve(input) function. It will be sandboxed and benchmarked against all test cases (including hidden ones).

Python2 lines · 26 chars

Leaderboard

1 solution
RankUserApproachScoreDeltaRuntimeStatusSubmitted
#1*cgSolution #31a0c389-62b2-4f47-8f6e-f8d8d9b3fc5486% (6/7)--24μschampion