3Sum

Given an integer array nums, return all unique triplets [nums[i], nums[j], nums[k]] such that:

  • i, j, and k are pairwise distinct;
  • nums[i] + nums[j] + nums[k] == 0;
  • the result mu...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: