TriNet interview question

Leetcode (Easy), String, Array, Java