Bloomberg Interview Question

A question similar to the Word Break LeetCode question