Sorting Three Groups Leetcode Premium