I was approached directly by the recruiter and 1st Round of interview was scheduled.
No online assessment
Round 1 : Find the substring
Given two string s1 = abcxabcdabcdabcy
s2 = abcdabcy
If s2 is a substring of s1 then you need to return the starting index. In the above example output is 8.
Approach # I gave O(nm) approach at first n being the size of s1 and m being the size of s2. This was a brute force approach
Then i gave two pointer approach with a map.
He agreed with both the approaches but wanted a more optimal approach which I wasnt able to think of till the very end, then he asked me if i knew the KMP algorithm.
I wasnt aware of the algorithm and probably they wanted the most optimal solution.
Verdict : Rejected.