mthree interview question

basic algorithm Qs... . .