Smallest String Starting From Leaf Leetcode Two Sum Solution Java