TIFIN interview question

Dsa questions medium and hard