Introduction
It is the weekly contest 109. I spent over 60 minutes to work on the algorithm, I submitted the solution six minutes after the contest since the internet was down.
My practice
I like to look into my thought process, and I started to code an iterative solution, but I failed. And then I moved to write a recursive function, I talked to myself to make N = 1, 2, 3 work first; and then I came cross the time out when N = 19. I knew that there is timeout issue. And then I wrote a dynamic programming solution
Actionable Item
The most important is that there are only 10 possible states. I will look into discuss on the algorithm and then learn a few more ideas to solve the algorithm.
No comments:
Post a Comment