Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution:
- def findRank(self, A):
- alphabet = sorted(A)
- ans = 0
- for i,x in enumerate(A):
- ans += alphabet.index(x) * math.factorial(len(A) - i - 1)
- alphabet.remove(x)
- return (ans + 1) % 1000003
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement