Saturday, July 21, 2018

Leetcode 198: House robber

July 21, 2018

Introduction


It is an easy level algorithm and dynamic programming can be applied to solve the algorithm. I think that it is so important to be humble. Once I decide to work on easy level algorithm last Tuesday, I start to notice that I have so many things to learn as a software programmer.

I do not need to stress myself too much. All I need is to train myself to solve problem using easy level algorithms first. After one week practice, I should have completed at least 30 easy level algorithms. So far, I have completed 10 easy level algorithms.

My practice 


Here is my C# code.


Mistake I made and index-out-of-range error, line 21 I should check array's length == 0. The index-out-of-range error is on line 31.

No comments:

Post a Comment