Saturday, January 13, 2018

One algorithm is tagged #好玩?

January 13, 2018

Introduction


It is the first time I tag the algorithm using Chinese word 好玩. I met the peer through the mock interview and I spent over 30 minutes time to discuss the solution with him. At the end of the discussion, he said that word in Chinese 好玩. Both of us worked on mathematics major, the peer works for a startup in California, and I work in the city Vancouver, Canada.

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