Cyz interview question

Dsa question medium level..problem solving ability