Smart Number 2 Hackerrank Solution