This problem was asked by Microsoft.
Given a string and a pattern, find the starting indices of all occurrences of the pattern in the string. For example, given the string "abracadabra" and the pattern "abr", you should return [0, 7]
.
To get the solution to this problem, sign up for the advanced version of my newsletter right here. Join various other coders nailing interviews at top-tier firms such as Facebook, Microsoft, Google, Fidelity, and more:
https://codinginterviewsmadesimple.substack.com/subscribe
To share interesting problems/solutions with me, reach out to me. Good problems and/or solutions receive a free shoutout + 2 months of the paid Anewsletter:
https://www.instagram.com/iseethings404/