Member-only story

Akul
7 min readJul 21, 2024

This is why I think Senior Engineers aren't clearing interviews

Source: https://www.reddit.com/r/leetcode/comments/xi1ioe/thoughts/

I want to cover a serious issue highlighted by a video posted by Gaurav Sen sometime back:

I want to show another point of view. What happens beyond the point Gaurav makes with a simple instance. I will take the leetcode problem of Wildcard Matching for this instance.

If you have never done this problem before, how would a Senior Engineer think of approaching it? Well, this is one way I would approach it:

class Solution:
MATCH_TERMS = ("?", "*")

def isMatch(self, s: str, p: str) -> bool:
print(f"s={s} p={p}")
s_len = len(s)
match p:
case "":
return False
case "*?":
return self.match_all_single_char(s)
case "?*":
return self.match_single_char_all(s)
case "*":
return True
case "?":
return self.match_single_char(s)
case single_char_pat if len(single_char_pat) == 1:
return s_len == 1 and single_char_pat == s
case p if p == s:
return True

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Akul
Akul

Written by Akul

Software.Analytics.Python.Elixir.

Responses (1)

Write a response