FastPrepWildcard Matching
Problems/Wildcard Matching

Wildcard Matching

Tripjack logoTripjack● HardFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: This comes from an in-person Tripjack interview for a backend role. Its first round had two coding questions, and this was one of them. The report only links to Wildcard Matching by name.

The report gives no limits or examples, so this version uses the usual rules: ? stands for one letter, * stands for any run of letters, and the pattern must cover the whole string. Both strings have up to 2000 characters.

Our version is about 95% the same as the reported question.

You are given a string s and a pattern p. Return true if the pattern matches the whole of s, and false otherwise.

Read the pattern like this:

  • A letter matches the same letter.
  • ? matches exactly one letter, any letter.
  • * matches any run of letters, including an empty run.

The match must cover all of s, not just part of it.

Function

isMatch(s: String, p: String) → boolean

Examples

Example 1

s = "tripjack"p = "trip*"return = true

trip matches the first four letters, and the star matches jack.

Example 2

s = "cab"p = "?a"return = false

The pattern has no star, so it matches exactly two letters. s has three letters, so it cannot match.

Example 3

s = "abcde"p = "a*c?e"return = true

a matches a. The star matches b. Then c matches c, ? matches d, and e matches e.

Example 4

s = ""p = "**"return = true

Both stars match an empty run, so the pattern matches the empty string.

Constraints

  • 0 <= s.length <= 2000
  • 0 <= p.length <= 2000
  • s contains only lowercase English letters.
  • p contains only lowercase English letters, ? and *.

More Tripjack Onsite Interview questions

  • Reconstruct ItineraryONSITE INTERVIEW · Seen Nov 2026
  • Jump Game IIONSITE INTERVIEW · Seen Aug 2026
  • Number of IslandsONSITE INTERVIEW · Seen Aug 2026
  • Zigzag ConversionONSITE INTERVIEW · Seen Aug 2026

Similar questions at other companies

  • Lexicographically Smallest Grid Path with One Letter ChangeInfosys · OAInfosys interview questions
  • Get Minimum ErrorsAmazon · OA
  • Match a Pattern With ? and *Adobe · PHONE SCREENAdobe interview questions
  • Most Relevant Text SpanHebbia · PHONE SCREEN
  • Maximize Beautiful SubstringsFortinet · OAFortinet interview questions
  • Minimum Taps to Water a GardenThe D.E. Shaw Group · ONSITE INTERVIEWThe D.E. Shaw Group interview questions
  • Interleaving StringsCARS24 · ONSITE INTERVIEW
  • Text JustificationGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Greedy and Beam Sentence DecodingMicrosoft · PHONE SCREEN · ONSITE INTERVIEWMicrosoft interview questions
  • Minimum Stickers to Form a Target StringByteDance · ONSITE INTERVIEWByteDance interview questions
All Tripjack interview questionsSee Tripjack hiring insights
Saved
class Solution {
    public boolean isMatch(String s, String p) {
        // Write your code here.
    }
}
Checking account…