IXL Learning interview question

LC med-hard question was asked