Tuesday, August 14, 2018

Leetcode 665. Non-decreasing array

August 14, 2018

Introduction


It is an easy level array algorithm. But success rate is less than 20%. I choose to work on the tough one first.

My practice 


Here is my C# code.

I made a mistake and then leetcode online judge failed me on the test case: [-1, 4, 2, 3]. I learned that there are two user cases. One is to replace index = i and second user case is to replace index = i + 1.

I like to share the submission result to remind myself gently, next time I should think carefully before I submit the code. Do not rely on the online judge. Think independently.


If I think carefully, I can save 11 minutes. In my practice, I spent over 10 minutes to correct those two failed test cases, one is [-1, 4, 2, 3].


No comments:

Post a Comment