Wednesday, July 18, 2018

Leetcode 273: Integer to English Words

July 18, 2018

Introduction


It is hard level algorithm. I had some discussion with a peer through mock interview more than three months ago. But I did not write code and did not submit anything through Leetcode online judge.

I know that it is important to write working code and pass online judge. And also I need to work hard to submit as many algorithms as  I can. The number cannot lie.

I have to submit code through Leetcode online judge, I like to demonstrate how hard I work on the practice. So I tried very hard to put together code today.

I like the effort I spent on the algorithm, although I still spent over 45 minutes to write code. I like to encourage myself to write more code in short future.

Every algorithm counts


It is best time for me to write a hard level algorithm when I have doubt for myself. I had good time to write code but there were so many mistakes in my code. I had to work on the bug fix depending on Leetcode online judge.

There are more than five places I stumbled this time since I had not written code a lot last few months.

Here is my C# code.

1. Line 19: Forty spell error: Fourty
2. Line 30, forgot to declare a variable called workingNumber,
3. Line 45, I did not reduce workingNumber to a smaller number first writing
4. Line 50, I tried to simplify the code, always a space is added
5. index out of range error, line 66, current is bigger than 1000 in my first running
6. current / 100 -> I wrote current % 100 at the first time, the bug was fixed
7. Line 77, biggerThan19 variable for the case is forgotten in my first writing


Life is so simple when I work hard to write code for a medium level algorithm. I just keep writing code and follow my coach's advice.

Time spent:

More than 30 minutes

My last practice is in the mock interview in March 2018. Here is the blog.

I just could not believe that I did not submit any code after March 2018 mock interview. It is important to get some training through Leetcode online judge.

Facts


As of July 18, 2018, solved 101/861, accepted submission: 759/511, Acceptance rate: 50.7% based on my Leetcode profile:
https://leetcode.com/jianminchen39/

No comments:

Post a Comment