Given an integer array nums, return the number with the smallest absolute value. If there is a tie, return the positive number.
nums = [-4,-2,1,4,8]1nums = [2,-1,1]1ans = nums[0]|nums[i]||nums[i]| < |ans|: update ans = nums[i]|nums[i]| == |ans| and nums[i] > 0: ans = nums[i] (tie → positive)Distance from zero = absolute value. We keep the element with the smallest |value| seen so far. Tie-breaking: both -x and x have the same distance, but we must return the positive one, so we update when we see a positive tie.