Target Triplet Sum
Problem statement
Given an integer array nums and an integer target, return whether three distinct indices have values whose sum equals target.
Your algorithm may reorder nums, but it must use only constant auxiliary space apart from the sorting implementation's call stack.
Function
hasTargetTriplet(nums: int[], target: int) → booleanExamples
Example 1
nums = [12,3,4,1,6,9]target = 24return = trueThe values 12, 3, and 9 sum to 24.
Example 2
nums = [1,2,4,8]target = 20return = falseNo three distinct indices produce 20.
Constraints
0 <= nums.length <= 100000.-10^9 <= nums[i], target <= 10^9.