BD interview question

some algorithm questions