#3838
Weighted Word Mapping
newbie · 135 · lc easy +13 · 85.2% accepted · 32 likes · top 96%
Description
Given a string array words (each word contains only lowercase English letters) and an integer array weights of length 26 (where weights[i] is the weight of the ith letter), the weight of a word is the sum of the weights of its characters. For each word, compute its weight modulo 26 and map the result to a letter in reverse alphabetical order (0 -> 'z', 1 -> 'y', ..., 25 -> 'a'). Return the string formed by concatenating these mapped letters for all words in order.
Code
1
2
3