first missing positive | first missing positive leetcode | leetcode 41 | array

Sdílet
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

Komentáře • 16

  • @NareshGupta
    @NareshGupta  Před 3 lety +1

    How was your experience with the September challenge?
    Try out this problem as well - leetcode.com/problems/find-all-numbers-disappeared-in-an-array/

  • @aman6561
    @aman6561 Před 3 lety +1

    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.

  • @wisdomkhan
    @wisdomkhan Před 2 lety +1

    how can id ever be negative? We have converted all negative and >n numbers to n+1 in above for already.

  • @vigneshvicki7020
    @vigneshvicki7020 Před rokem

    Simple yet clear

  • @sagarkeshri
    @sagarkeshri Před 3 lety +1

    Awesome approach sir :)

  • @ar-rahman8289
    @ar-rahman8289 Před rokem

    JS implementation
    var firstMissingPositive = function(nums) {
    let length = nums.length;
    if(!nums.includes(1)) {
    return 1;
    }
    for(let index=0;index

  • @ashishm8850
    @ashishm8850 Před 3 lety

    Very well explained. Thanks!

  • @ar-rahman8289
    @ar-rahman8289 Před rokem

    not correct solution, even boundary conditions not handled, no check for 1 present or not

  • @animepoll9236
    @animepoll9236 Před 2 lety

    nice explanation

  • @ar-rahman8289
    @ar-rahman8289 Před rokem

    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