Huld interview question

It was a coding assignment on Java.