— I think that is better than trying to let the data structure itself define sections, at least when you use a linked list like that
set, you would lookup existing characters, then add only missing characters but to the end of the array
— To represent something, maybe some map like this:
— But integers are also pass-by-value, so that defeats the purpose of trying to be more memory efficient, but you get the idea
— So maybe instead, a Bloom filter would work better, since you are re-using the same hash for multiple objects
— It is a simple bit array
— "While risking false positives, Bloom filters have a strong space advantage over other data structures for representing sets, such as self-balancing binary search trees, tries, hash tables, or simple arrays or linked lists of the entries."
— Since there can only be 26 letters and 10 numbers represented, I think it should work perfectly
— "However, if the number of potential values is small and many of them can be in the set, the Bloom filter is easily surpassed by the deterministic bit array"
— It does a single loop str.length times for every addition and lookup
length property is very efficient, is a stored integer