As reported: Oracle OCI IC2, loop round 2 (hiring manager), Mar 2025 — architecture and project questions, then 3Sum.
Given an integer array nums, return all distinct triplets [nums[i], nums[j], nums[k]] with i, j, k pairwise different and nums[i] + nums[j] + nums[k] == 0. The answer must not contain the same triplet of values twice.
This is LeetCode 15 — 3Sum.
Example 1
nums = [-1,0,1,2,-1,-4]
Output: [[-1,-1,2],[-1,0,1]]
Example 2
nums = [0,1,1]
Output: []
Example 3
nums = [0,0,0]
Output: [[0,0,0]]
Constraints: 3 ≤ nums.length ≤ 3000; -10^5 ≤ nums[i] ≤ 10^5.
Code runner format: one JSON value per line — nums. Implement threeSum(nums); triplets and the values inside each may come in any order (the harness sorts them before printing).