Closest to Zero

Part 1

Given a list of integers find the closest to zero. If there is a tie, choose the positive value.

Part 2

Given a list of strings, find the one closest to “zero”. A word is close to “zero” if it contains the same letters. If more than one word contains the same letters, choose the shortest one. If more than one is the same length, choose the one with the letters in the most similar order. If there is still a tie, choose the one that appeared first in the original list.

Acknowledgments

This kata is described on cyber-dojo.org, I added part 2.

Referenced in these Learning Hours: