Wednesday, May 23, 2018

Find string s2 containg s1 permutation - 5th interview from my coach

May 23, 2018

Introduction


It is the algorithm called find string s2 containing s1 permutation. I wrote the algorithm using sliding window, and also implement the algorithm using time complexity O(N) where N is the length of string s2.


Algorithm


Here is the transcript for my mock interview. We used Google Docs.

I wrote the code but there are some issues in my code. The coach spent over 5 minutes to test my code using a test case, and then he shared with me his implementation using time complexity O(26*N) solution.

Here is my C# algorithm I wrote after the mock interview.

No comments:

Post a Comment