From 1fe0c770f9bc6b37661fa5c6b8074bbce7f02edf Mon Sep 17 00:00:00 2001 From: bumpsoo Date: Sat, 13 Jun 2026 09:24:24 +0000 Subject: [PATCH] https://leetcode.com/problems/weighted-word-mapping --- easy/weighted_word_maaping.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 easy/weighted_word_maaping.py diff --git a/easy/weighted_word_maaping.py b/easy/weighted_word_maaping.py new file mode 100644 index 0000000..ffdb5c6 --- /dev/null +++ b/easy/weighted_word_maaping.py @@ -0,0 +1,11 @@ +# https://leetcode.com/problems/weighted-word-mapping + +class Solution: + def mapWordWeights(self, words: List[str], weights: List[int]) -> str: + result = [] + for word in words: + weight = 0 + for c in word: + weight += weights[ord(c) - ord('a')] + result.append(chr(ord('z') - weight % 26)) + return ''.join(result)