IBM Interview Question

Leetcode hard string and array