UST interview question

Some basic logic implementation