Question d’entretien chez Oracle

I had to complete Closest numbers hackerrank exercise