const hasPairSum = (nums, desiredValue) => {
if(nums.length < 2) {
return false;
}
const [firstNum, ...tailNums] = nums;
const hasDesiredValue = tailNums.some((num) => firstNum + num === desiredValue);
return hasDesiredValue || hasPairSum(tailNums, desiredValue);
};