Introduction
It is very good time to coach each other after 50 minutes mock interview. I asked the peer to solve the algorithm called maximum number of chunks.
Algorithm discussion
Here is the transcript for our discussion. The final result is that both of us are very happy. I like to measure how good the peer can think and analyze the problem, he did so well, and then he came out a simple formula for the solution.
At the very beginning, I presented the problem statement. And then the peer asked me can you give more examples?
So what I did is to add more examples. And then we discussed the brute force solution. What is maximum number of first chunk options.
First chunk always starts from index equal to zero, but the end value can be index value 0 to N - 1. The peer came out the checking of running sum equals to the expected sum of ( 1 + 2 +...+ index).
No comments:
Post a Comment