Leetcode Minimum Swaps To Sort Arraylist Java