Honeywell Interview Question

Hacker rank 2 coding question.