Microsoft interview question

LC Easy + LC Medium