3Sum Closest | Leetcode 16 | Two Pointer | Google Facebook Amazon

Sdílet
Vložit
  • čas přidán 26. 07. 2021
  • Problem Link - leetcode.com/problems/3sum-cl...
    Subscribe for more educational videos on data structure, algorithms and coding interviews - czcams.com/users/NareshGupta?s...
    Code Repository - github.com/naresh1406/youtube...
    Popular Playlists:
    Top Interview Questions: • Top Interview Questions
    Dynamic Programming: • Dynamic Programming - DP
    Graph: • Tree 🌳
    Tree: • Tree 🌳
    Array: • Array
    Binary Search: • Binary Search
    Linked List: • Linked List
    Stack: • Stack
    Backtracking: • Backtracking
    Trie: • Trie
    Combinations and Permutations: • Combinations and Permu...
    Best Time to Buy and Sell Stock: • Best Time to Buy and S...
    Intervals Problems: • Intervals Problems
    House Rober: • House 🏠 Robber
    Top Interview Questions - • Top Interview Questions
    May LeetCoding Challenge 2021 Playlist: • May LeetCoding Challen...
    April LeetCoding Challenge 2021 Playlist: • April LeetCoding Chall...
    March LeetCoding Challenge 2021 Playlist: • March LeetCoding Chall...
    February LeetCoding Challenge 2021 Playlist: • February LeetCoding Ch...
    January LeetCoding Challenge 2021 Playlist: • LeetCode December Chal...
    December LeetCoding Challenge Playlist: • LeetCode December Chal...
    November LeetCoding Challenge Playlist: • LeetCode November Chal...
    October LeetCoding Challenge Playlist: • LeetCode September Cha...
    September LeetCoding Challenge Playlist: • LeetCode September Cha...
    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
    Follow me on -
    LinkedIn - / nareshiitg
    Instagram - / naresh_gupta_
    Facebook - / cookcodetravel
    Quora - www.quora.com/q/cookcodetravel
    #Google #Amazon #TwoPointers #Array #Leetcode #Algorithm #DataStructure #Java #Preparation #NG #nickode #CookCodeTravel #CCT

Komentáře • 11

  • @danishshaikh2994
    @danishshaikh2994 Před rokem +1

    NIce Explaination

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

    but sir in the explanation during 5:55 time duration sum is -4-1+2 but diff will be sum-target so diff will be -3-1=- 4 not -3 where target is 1

  • @pallavithukral9690
    @pallavithukral9690 Před 3 lety

    due to sorting space complexity will be O(log N) or O(N log N)???

  • @prathamkesarkar
    @prathamkesarkar Před 3 lety

    How it is not n^2(log n)

    • @NareshGupta
      @NareshGupta  Před 3 lety

      we are nesting two pointer while loop in a for loop so N ^ N

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

      Time Complexity: O(n^2)
      As We have outer and inner loops, each going through n elements.
      Sorting the array takes O(n*log(n)), so OVERALL complexity is O(n^2 + n*log(n)) .
      => This is asymptotically equivalent to O(n^2).