Relative Sort Array Leetcode Solution Python