Sponsored
Use these hints if you're stuck. Try solving on your own first.
The optimal values to check are <code>nums[i] - k</code>, <code>nums[i]</code>, and <code>nums[i] + k</code>.
Solve with full IDE support and test cases