Showing posts with label Leetcode 41: Find missing positive. Show all posts
Showing posts with label Leetcode 41: Find missing positive. Show all posts

Monday, March 26, 2018

Leetcode 41: Find missing positive

March 26, 2018

Introduction


I like to get organized on those mock interview algorithm. One algorithm is called Find first nonnegative integer in the array, I went over the practice and added the label. Also I found out that I need to work on the hard level algorithm Leetcode 41: Find missing positive.

It is my idea to practice 10 ideas based on Leetcode discussion in order to learn a hard level algorithm.


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).