Calance interview question

DS and ALGO