Three Indexes Adding Zero

Start Timer

0:00:00

Upvote
1
Downvote
Save question
Mark as completed
View comments

Find all sets of 3 indexes of an array so that the three indexed elements add up to 0.

Note: You may assume the input array is sorted in ascending order.

Example

For example, if the input array is:

array = [-2, -1, 1, 1, 3]

The result should be:

result = [{0,1,2}, {2,3,4}]
.
.
.
.
.


Comments

Loading comments