first missing positive | first missing positive leetcode | leetcode 41 | array
Vložit
- čas přidán 29. 09. 2020
- Problem Link - leetcode.com/explore/challeng...
Subscribe for more educational videos on data structure, algorithms and coding interviews - czcams.com/users/NareshGupta?s...
September Challenge - leetcode.com/explore/challeng...
Code Repository - github.com/naresh1406/youtube...
August LeetCoding Challenge Playlist: • LeetCode August Challenge
July LeetCoding Challenge Playlist: • LeetCode July Challenge
June LeetCoding Challenge Playlist: • LeetCode June Challenge
May LeetCoding Challenge Playlist: • LeetCode May Challenge
LeetCode Recent Contest ProblemsPlaylist: • Leetcode
LinkedIn - / nareshiitg
Instagram - / naresh_gupta_
Facebook - / 2784412725174003
Quora - qr.ae/pN2M0x
#Array #First #Missing #Positive #First_Missing_Positive #Code #Interview #Practice #September #Leetcode #Hard #41 #Algorithm #DataStructure #Java #Preparation #NG #nickode #CookCodeTravel #CCT
How was your experience with the September challenge?
Try out this problem as well - leetcode.com/problems/find-all-numbers-disappeared-in-an-array/
great explanation
in first attempt i did it with hashSet and I was very happy then I read that do it without extra space.
come to your solution honestly mind blowing.
Thanks and Keep Practicing
how can id ever be negative? We have converted all negative and >n numbers to n+1 in above for already.
Simple yet clear
Glad it helped
Awesome approach sir :)
Many thanks
JS implementation
var firstMissingPositive = function(nums) {
let length = nums.length;
if(!nums.includes(1)) {
return 1;
}
for(let index=0;index
Very well explained. Thanks!
Thsnks and Enjoy
not correct solution, even boundary conditions not handled, no check for 1 present or not
nice explanation
Thanks and welcome
If array is [5,7,8] with your solution after first step array is [4,4,4], I don't think your approach is right
it will return 1 as output