Global Relay interview question

basic algorithm questions.