Friday, November 3, 2017

Leetcode 41: First missing positive

Nov. 1, 2017

Plan to look into Leetcode and find the similar algorithm called get smallest nonnegative number.

Get smallest nonnegative number, do not change the array.

My C# practice code is here on Nov. 1, 2017

Also, I spent almost 50 minutes to interview the peer on Nov. 2, 2017 and had some discussion about the algorithm. I like the peer to go over the base cases to show very good reasoning.

[],   0
[0], 1
[1], 0
[0, 2, 3]  1
[3, 0 , 2] 1
[0, 1, 2, 10000]


Leetcode 41: First missing positive 


It is the hard level algorithm. Time complexity is O(n), space is O(1).




No comments:

Post a Comment