Dimentrix interview question

logic based programing question