Find the disappearing numbers (LeetCode 448) | Full solution with examples | Study Algorithms

Sdílet
Vložit
  • čas přidán 30. 06. 2024
  • An integer array of size 'n' contains elements in the range of [ 1, n ] There may or may not be repeating numbers. You need to find the numbers that are disappeared from this range. In this video we explore the most straight forward way to approach this problem and then try to optimize it eventually. The video discusses an in-place solution that is both time and space efficient. All of this along with beautiful animations and visuals. The dry-run of code is also provided in JAVA.
    Chapters:
    00:00 - Intro
    01:13 - Problem statement and description
    03:13 - Brute Force Method
    05:05 - Space and Time Efficient Solution
    09:50 - Dry-run of Code
    12:11 - Final Thoughts
    📚 Links to topics I talk about in the video:
    Array Data Structure: • Array Data Structure e...
    Brute Force Solutions: • Brute Force algorithms...
    What is Big O?: • Big O Notation Simplif...
    Time Complexity of an algorithm: • What is the Time Compl...
    📘 A text based explanation is available at: studyalgorithms.com
    Code on Github: github.com/nikoo28/java-solut...
    Test-cases on Github: github.com/nikoo28/java-solut...
    📖 Reference Books:
    Starting Learn to Code: amzn.to/36pU0JO
    Favorite book to understand algorithms: amzn.to/39w3YLS
    Favorite book for data structures: amzn.to/3oAVBTk
    Get started for interview preparation: amzn.to/39ysbkJ
    🔗 To see more videos like this, you can show your support on: www.buymeacoffee.com/studyalg...
    🎥 My Recording Gear:
    Recording Light: amzn.to/3pAqh8O
    Microphone: amzn.to/2MCX7qU
    Recording Camera: amzn.to/3alg9Ky
    Tablet to sketch and draw: amzn.to/3pM6Bi4
    Surface Pen: amzn.to/3pv6tTs
    Laptop to edit videos: amzn.to/2LYpMqn
    💻 Get Social 💻
    Follow on Facebook at: / studyalgos
    Follow on Twitter at: / studyalgorithms
    Follow on Tumblr at: / studyalgos
    Subscribe to RSS feeds: studyalgorithms.com/feed/
    Join fan mail: eepurl.com/g9Dadv
    #leetcode #programming #interview

Komentáře • 23

  • @mindmatters851
    @mindmatters851 Před rokem +2

    your explanation is too good every one can understand . thanks bro

  • @CostaKazistov
    @CostaKazistov Před 2 lety +4

    That's pretty clever.
    Really interesting solution.👍

  • @manishjeena6325
    @manishjeena6325 Před 11 měsíci +1

    Wow, Amazing Explanation 🥰🙏Thank You❤

  • @l1z1ng3r
    @l1z1ng3r Před 7 měsíci

    thank for the video) 💘

  • @RavinderSingh-nh6th
    @RavinderSingh-nh6th Před 10 měsíci +1

    Thank you so much

  • @priyankarai7917
    @priyankarai7917 Před rokem

    great explanation👍👍

  • @nerd6134
    @nerd6134 Před 2 lety

    Fire 🔥 bro

  • @pranav8609
    @pranav8609 Před rokem +2

    you are underated

  • @TraderOff-Road
    @TraderOff-Road Před 5 dny

    thaaanks

  • @subee128
    @subee128 Před 6 měsíci

    Thanks

  • @shubhambelwal674
    @shubhambelwal674 Před měsícem

    you have made this approach ??
    by the way ,i liked this approach

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

    Tried this using the count sort. I have created a temp array and stored the frequencies.Is my approach can be considered as optimal?

    • @nikoo2805
      @nikoo2805 Před 2 lety

      Yep…this solution will also be optimal

  • @Englishwithhimanshu8581
    @Englishwithhimanshu8581 Před 8 měsíci

    Good bhaiya

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

    I couldn’t understand the brute force method and efficient method time complexity difference... In brute force meth, iterating through every elements doesn’t take O(n) too? :)

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

      In Brute Force method you are iterating over the array again and again to find the element. So you are doing n iterations for n items.
      Hence, a time complexity of O(n^2)
      In the efficient method, you only iterate once
      Hope that helps :)

    • @mdanik1361
      @mdanik1361 Před 2 lety

      @@nikoo2805 thank u...can u share the brute force code please?

  • @vigneshr4197
    @vigneshr4197 Před rokem +1

    No need to create new array while multiplying with -1?

    • @ashrafel-gaaly8657
      @ashrafel-gaaly8657 Před 8 měsíci

      I think you do if some elements in the array are negative. In these examples they are all positive and yes you can update the existing array

  • @RohanSingh-my3nl
    @RohanSingh-my3nl Před 2 měsíci

    Making Video is So long for no reason
    Thuuuuuuuuuuuuuuuuuuuuuuuuuuuuu

    • @nikoo28
      @nikoo28  Před 2 měsíci +1

      Everyone has a different learning pace my friend. For quick learners there are always timestamps and chapters you can skip to :)