Amazon Interview Question

Problem on Strings and arrays