You are viewing a single comment's thread. Return to all comments →
The topic implies an interesting datastructure (e.g. "trie"), but a hash with the string as key and count as value is a simple and efficient solution. See github/bcreane for hash approach.
Maybe there's a way to lead us toward the data structure you were thinking of, and require intermediate steps be documented in stdout?
Btw, thanks for the problems :-)
The problem is reffering to sparse array. Prefix tree differs is totaly different structure. Main usage of the prefix tree (trie) is dymanic string matching, while space arrays are good for storing big sparse data in a compact form. Sparse array and matrixes are very common in leaner solvers.