Sorting Three Groups Leetcode Rating