brain dead solution in python
Intuition\nUses the idea of tries but no tries hehe\n\nHonestly, just build the prefix of a word as you go.\n\n# Approach\nFor each word, I create a buffer and 
# Intuition\nUses the idea of tries but no tries hehe\n\nHonestly, just build the prefix of a word as you go.\n\n# Approach\nFor each word, I create a `buffer` and build a prefix for each character of the word.\n\nSo I continuously build a `buffer` character at a time without doing some weird indexing calculation.\n\nOnce the buffer has an appended character I check if that character is in `ws`. If not, add an entry to `ws` for buffer to zero, if so just increment by one.\n\nSo that is the first pass.\n\n2nd pass,\n\nSame thing as the first, building the prefix for each word,\nbut here I am checking the overall count that the current buffer appears and summing it into its respective index with the variable `counts`.\n\nand yeah just return counts yeet\n\n# Complexity\n- Time complexity:\nthe yung O(N * M) where N is the number of words and M is thee max size of word.\n\n- Space complexity:\nO(N * M) + O(N) = O(N * M)\n\ngg bois\n# Code\n```\nclass Solution:\n    def sumPrefixScores(self, words: List[str]) -> List[int]:\n\n\n        ws = dict()\n\n        for word in words:\n            buffer = ""\n            for c in word:\n                buffer += c\n                if buffer not in ws:\n                    ws[buffer] = 0\n                ws[buffer] += 1\n\n        counts = [0] * len(words)\n        for i, word in enumerate(words):\n            buffer = ""\n            for c in word:\n                buffer += c\n                if buffer in ws:\n                    counts[i] += ws[buffer]\n        return counts\n\n```
['Python3']