Saturday, November 3, 2018

935. Knight dialer

Nov. 3, 2018

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


I like to solve the algorithm in less than 10 minutes. I spent so many time to work on similar algorithm since I helped a friend to review Google phone interview. Here is the blog. Here is my discuss link on Leetcode.com.




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