Introduction
It is the great learning opportunity in Sunday morning. I spent 40 minutes to work with the peer on her first time to solve smallest substring containing all characters. I learn from the peer to work on the solution, the peer solved the problem to pass all test cases with my help. Even though the time complexity can be improved.
Code review
Here is the gist I wrote for the analysis of time complexity and I explained the issue using an example.
Highlights of my review on mock interview:
1. line 20 - 22, I made the suggestion to group all three int variables declaration together.
2. line 26, I found the bug to add head <= runner instead of head < runner
3. line 27, I advise the peer to extract a variable currentChar to avoid duplication code
4. I added extra line on line 35 and a few other places
5. I argued with the peer the idea of runner = head -1 on line 42 and then I understood her idea, because she likes to offset +1 on line 47
6. I added line 47 for the peer
7. I told the peer that I like to review the code before she likes to run the code, so I can make the changes from item 1 to item 6.
No comments:
Post a Comment