Microsoft interview question

Data Structues and Algorithms One string question and a followup question