Amazon interview question

They asked me a leetcode style question based on string manipulation and arrays.