Amazon Interview Question

There is a word break problem in leet code