String match
MediumLet's say you want to know if a string contains a substring.
Python has built-in methods that can do this for us:
matches = some_substring in main_string # either True or False
But how is this implemented under the hood?
Write a function that implements this functionality.
For example, if your function is given the arguments
bitcoin
and coin
, your function should return True
.But if you're given
bitcoin
and usd
, your function should return False
.Try it
Solution
6 Essential Strings Coding Interview Problems
Master Strings by trying the coding challenges below.
- 1.Reverse StringEasy
- 2.AnagramEasy
- 3.Reverse wordsMedium
- 4.String matchMedium
- 5.CompressionMedium
- 6.One edit awayHard