Rank Transform of an Array

Solution Code
class Solution:
    def arrayRankTransform(self, arr: List[int]) -> List[int]:
        num_to_rank = {}
        nums = sorted(set(arr))
        rank = 1
        # ... logic continues ...

Time Complexity

O(N log N)

Space Complexity

O(N)