Prep

Saturday, 1 August 2020

Largest Sub-array With Sum Zero - Hashing Problem

Problem : Find the maximum length of the largest sub-array with sum zero.
Following is the implementation, where we store the sum at every index in hashmap and look for sum already being present in hashmap(only possible if sum of the sub-array is zero):



Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels: hash, hashing, problems

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Pages

  • Union Find Algorithms
  • Queues
  • Stacks
  • Sorting Algorithms
  • Home

Blog Archive

  • ►  2022 (2)
    • ►  October (1)
    • ►  September (1)
  • ▼  2020 (42)
    • ▼  August (13)
      • Array Rotation - Three Solutions
      • Top K Frequent Elements - Hashing Problem
      • Sort By Frequency - Hashing Problem
      • Count Distinct Elements In Every Window - Hashing ...
      • Print Non-repeated Elements - Hashing Problems
      • Relative Sorting - Hashing Problems
      • Zero Sum Sub-arrays Count - Hashing Problems
      • Largest Sub-array With Sum Zero - Hashing Problem
      • Four Sum - Hashing Problems
      • Two Sum - Hashing Problem
      • Longest Consequent Sub-sequence - Hashing Problem
      • Maximum Distance Between Two Occurences Of Same El...
      • Check If Two Arrays Are Equal - Hashing Problems
    • ►  July (7)
    • ►  June (17)
    • ►  May (5)
  • ►  2017 (4)
    • ►  October (4)
Powered by Blogger.