XYZ interview question

regarding the coding and performance