Luxoft interview question

Coderbyte algorithm test has 2 basic question