Pergunta de entrevista da empresa Oracle

I had to complete Closest numbers hackerrank exercise