Amazon Interview Question

They asked to solve an arrays and string problem.