All practice tasks

Coding (Algo)

Wildcard Route Match

Dynamic programming · Hard

A static routing tool supports a small glob language to decide whether a complete path matches a route pattern.

Match the entire path using ? for one character and * for zero or more characters.

Input

Call

  • Implement solve(input) and return its result. Do not print from solve.

Input object

{ path:string, pattern:string }

Input rules

  • Paths contain lowercase ASCII letters and /.
  • Patterns additionally contain ? and *; wildcards may match /.

What each field means

  • path — the complete path string to match.
  • pattern — literal characters plus ? for one character and * for zero or more characters.
  • Both wildcards may match /; there is no escape syntax.

Output

Return value and rules

  • Return a boolean indicating whether the pattern matches the entire path.
  • Matching only part of the path is not enough.
  • An empty pattern matches only an empty path.

Constraints

  • 0 <= path.length, pattern.length <= 2000
  • No escaping, regex classes or special treatment of repeated stars.

Examples

Example 1

{
  "path": "api/users",
  "pattern": "api/*"
}

Returns

true

Example 2

{
  "path": "abc",
  "pattern": "a?c"
}

Returns

true

Required complexity

O(nm) time and O(m) space

What this task practices

Wildcard Route Match is a coding (algo) interview exercise that trains prompt interpretation, explicit assumptions, a concrete response, and a clear explanation of tradeoffs. The catalog marks it as hard difficulty. It focuses on Technical Reasoning, Testing, Validation. The signed-in workspace provides the tools for the round and evaluates the attempt against task-specific criteria. Reference solutions, hidden checks, evaluator instructions, and candidate work remain private.

Sign in to startThe workspace and evaluation open after sign in.