Saturday, October 20, 2018

Leetcode 927. Three equal parts

Oct. 20, 2018

Introduction


It is a hard level algorithm. I tried to write the solution in the contest but I could not manage to pass online judge since I had several issues.

My solution


I wrote a solution and shared on leetcode discuss. Here is the link.


My journey


I spent 50 minutes to work on the algorithm in the last week contest. I made the first submission until there is 10 minutes left. And then I submitted second time.

First submission is here, line 35 index out of range runtime error.
int index2 = map[numberLength];

Second submission is here, I gave the wrong answer. I need to review the definition of return indexes. Line 44 statement needs to be changed. 


Actionable items


Definitely I should work more carefully on some test cases, so I can verify my code is working for those test cases.

I also need to figure out how to simplify the code before I make any submission. There is a 5 minutes penalty for each failed submission.

No comments:

Post a Comment