Skip to content
This repository was archived by the owner on Sep 7, 2025. It is now read-only.

Conversation

@arctistic
Copy link
Contributor

@arctistic arctistic commented Oct 2, 2019

Given an array consisting of positive and negative integers, find the length of the longest continuous subset whose sum is zero.
To be done in O(n) time complexity. The use of hash-maps helps bring down the complexity to O(n).
Eg: Array size: 10
Array: 95 -97 -387 -435 -5 -70 897 127 23 284
Then the length longest continious subset/sequence which sums up to zero is 5
Since the longest continious subset which sums up to zero is -387 -435 -5 -70 897.

This program makes use of hashmaps and the STL is unordered_map.

This pull request is:

  • A new Algorithm
  • An update to an existing algorithm.
  • An error fix
  • Other (Describe below*)

This pull request fixes:

Changes:

Given an array consisting of positive and negative integers, find the length of the longest continuous subset whose sum is zero. To be done in O(n) time complexity. The use of hash-maps helps bring down the complexity to O(n). Eg: Array size: 10 Array: 95 -97 -387 -435 -5 -70 897 127 23 284 Then the length longest continious subset/sequence which sums up to zero is 5 Since the longest continious subset which sums up to zero is -387 -435 -5 -70 897. This program makes use of hashmaps and the STL is unordered_map.
Given an integer array of size 2N + 1. In this given array, N numbers are present twice and one number is present only once in the array. You need to find and return that number which is unique in the array.
@abranhe abranhe merged commit 8b4ee60 into AllAlgorithms:master Oct 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants