Sr Staff, coupang| Phone screen
Anonymous User
2284

Given two strings, str, pattern, find # of discontinous matches of pattern in str. None of the matched letters can be next to each other in str.
examples:

  1. pattern="cat", str="catapult", result=1, explantation: CatApulT
  2. pattern="cat", str="catatapult", result=2, explantation: CatcAtapulT, CatcatApulT, catCatApulT

Looked difficult and I applied recursive with back tracking, they asked to actually compile and run the code in hackerrank (after fixing syntax errors lol) . there was a minor issue in handling previous index, but was able to convey it. Not sure if that will be fine to get into next level.

Comments (7)