Leetcode solutions using Java