Back to problems

3Sum (No Duplicate Triplets Assumed)

Algorithm · Walmart Labs · Medium

Problem: 3Sum (Triplet Deduplication Not Required) Given an integer array nums, identify every triplet (a, b, c) that uses three different indices and satisfies: a + b + c == 0 For this follow-up, duplicate triplets do not have to be removed. The inputs or requirements may already prevent duplicates, or the interviewer may accept a result containing them. Requirements Describe your algorithm and its time and space complexity; a verbal explanation is enough. If you write…

Checking your access…