Meta interview question

LC Medium: Word Break problem