Uniqode interview question

Based on DS and algo