We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 38ad0b7 commit 600aa72Copy full SHA for 600aa72
Python/rank-transform-of-an-array.py
@@ -0,0 +1,10 @@
1
+# Time: O(nlogn)
2
+# Space: O(n)
3
+
4
+class Solution(object):
5
+ def arrayRankTransform(self, arr):
6
+ """
7
+ :type arr: List[int]
8
+ :rtype: List[int]
9
10
+ return map({x: i+1 for i, x in enumerate(sorted(set(arr)))}.get, arr)
0 commit comments