Skip to content
Snippets Groups Projects
Commit 5969eb3f authored by Cynthia Soimansoib's avatar Cynthia Soimansoib
Browse files

Add README.md

parent e9b7107d
No related branches found
No related tags found
No related merge requests found
Resolution in Java language of the Closest to Zero exercise.
Requirements:
Closest to zero
Write a function “closestToZero” described by the following specifications:
given an array of positive and negative integers, it returns the closest number to zero
if the closest number in input could be either negative or positive, the function returns the positive one
if the input array is undefined or empty, the function returns 0
Examples:
when input is [8, 5, 10] it must returns 5
when input is [5, 4, -9, 6, -10, -1, 8] it must return -1
when input is [8, 2, 3, -2] it must return 2
when input is [2, 0], it must returns 0, as 0 is ... the closest number to 0
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment