diff --git "a/leetcode3/\354\265\234\353\257\274\354\247\200/3838-weighted-word-mapping.py" "b/leetcode3/\354\265\234\353\257\274\354\247\200/3838-weighted-word-mapping.py" new file mode 100644 index 00000000..5f379ec3 --- /dev/null +++ "b/leetcode3/\354\265\234\353\257\274\354\247\200/3838-weighted-word-mapping.py" @@ -0,0 +1,12 @@ +class Solution: + def mapWordWeights(self, words: List[str], weights: List[int]) -> str: + weight_alpha = [] + for word in words: + word_sum = 0 + + for w in word: + word_sum += weights[ord(w)-ord('a')] + weight_alpha.append(chr(ord('z') - word_sum % 26)) + return ''.join(weight_alpha) + + \ No newline at end of file