Algorithm · Citadel · Medium
For an integer array nums, determine how many different triplets (i, j, k) satisfy i < j < k and nums[i] + nums[j] + nums[k] == 0. State the algorithm's time complexity and include implementation code. Example: Input: nums = [-2, 0, 2, 1, -2, -3] Output: 3 Explanation: The three qualifying index triplets are (0, 1, 2), (1, 2, 4), and (2, 3, 5), corresponding to the value triplets (-2, 0, 2), (-2, 0, 2), and (-3, 1, 2). Example Input: [-3, 1, 2, 0, -1, 3] Output: 3…
Checking your access…