Skip to content

Problems ​

1/ Find value nearest to 0 ​

Problem: Given an array of integer nums. Find the number that is nearest to 0 Iterate each element, find the minimum number but use Math.abs() to check for absolute number, we still store result as nums[i] to return the correct answer.