Given a list of `words` and a list of `queries` (each a non-empty prefix string), return for each query how many words start with that prefix. Build a prefix tree so each query is answered in O(query length).
Examples
in: words = ["apple","app","apply"], queries = ["app","appl"]
out: [3,2]
all 3 start with app; apple/apply start with appl
Constraints
0 <= len(words) <= 10^4
lowercase letters
queries are non-empty
Hints
target: O(total characters) time⌘↩ run · ⇧⌘↩ submit