Your question is Pair Sum to Target. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Deloitte's consulting analytics tools may need to quickly validate whether two observed integer values satisfy a target relationship. Given an integer array nums and an integer x, determine whether two distinct elements sum exactly to x.
Return True if such a pair exists. Return False otherwise. The same array element cannot be used twice, but duplicate values at different indices may form a valid pair.
Implement has_pair_with_sum(nums, x).
nums, a list of integers, and x, an integer target.i and j exist such that nums[i] + nums[j] == x.def has_pair_with_sum(nums, x):