# Description :

You are given a string of numbers (positive and negative but not decimals) along with the number of entries like so.

Like so

8 '1 2 5 0 7 -9 12 -8'

Your job is to return the number closest to zero be it +ve or -ve. Your input will be separated by spaces only. You are free to return the answer in any way you like namely :

1. A string
2. A float (Why would you though)
3. An array (One digit array I guess)
4. A number (preferred)

Since this is code golf the answer with the shortest will be the winner. I guess?

Have fun.

### code snippets :

console.log(6
'1 -2 -8 4 3 5') // should return 1
console.log(3
'-12 -5 -137') // should return -3
console.log(8
'1 2 5 0 7 -9 12 -8') // should return 0

### Note :

This is my first attempt at this. Apologies in advance for any mistakes, do tell so I can correct them. Thanks

• 1). updated my bad. Apr 12 '18 at 12:15
• 2). Ok updated. I was not aware that is is a duplicate. Apr 12 '18 at 12:15
• Can we take the input as a list of numbers?
Apr 12 '18 at 12:16
• Welcome to the site! As user202729 has mentioned, this is almost an exact duplicate of this existing challenge. Be sure to use the Sandbox to check if your challenges are duplicates and to catch any errors before posting. Also, make sure to read Things to avoid when writing challenges to see what to avoid and what to include. Apr 12 '18 at 12:16
• Sorry , just joined I was not aware of this. I will be sure to check before posting. Thanks for helping. Apr 12 '18 at 12:20

lambda n:min(map(abs,map(int,n.split())))