Array - 37: Find all Quadruple for given Sum

Sdílet
Vložit
  • čas přidán 7. 09. 2024
  • Source Code:thecodingsimpl...
    Solution:
    - Sort the array
    - Take two loop & iterate each element
    - Now for each element, you check if there exists a pair whose sum is equal to targetSum - current value
    - When you find out value, you add in final list, else you increase start or decrease end depending on value addition
    Time Complexity: O(n * n * n)
    Space Complexity: O(1)
    Do Watch video for more info
    CHECK OUT CODING SIMPLIFIED
    / codingsimplified
    ★☆★ VIEW THE BLOG POST: ★☆★
    thecodingsimpli...
    I started my CZcams channel, Coding Simplified, during Dec of 2015.
    Since then, I've published over 400+ videos.
    ★☆★ SUBSCRIBE TO ME ON CZcams: ★☆★
    www.youtube.co...
    ★☆★ Send us mail at: ★☆★
    Email: thecodingsimplified@gmail.com

Komentáře • 12