MetGlobal interview question

basic algorithm questions.