Upstox Interview Question

Word break problem on leetcode