Message from JavaScript discussions

May 2017

— 

{

  A: 2

}

— 

Just keep track of how many of the letters were seen, then on deletion decrement it... if it goes to 0, remove it from uniques, :D

— Yes

— That works

— Interesting... this lets us do a check at the beginning... count the characters in the input string and see if there's enough in the set to account for the word

Message permanent page

— So if we keep track of how many "F"'s are in the set, and there's like 2... then we can count the "F"s in the input string, and if they're more than 2 then we know it's not in the set

Message permanent page

— You actually only have to incr / decr once per word

— So as long as there's enough of each letter in that uniques list to be equal or greater to the letters counted in the input string, we know it's "probably in the set"

Message permanent page

— It's total letters, so for "Hello", we have 2 L's added

— Yeah, but you could increment once as well

— This lets us know if words in the set use any of the unique letters without knowing which words they are

Message permanent page

— Adding "Helion" will make it get to that check, and it will notice the L's in "Hello" are more than are in the set, and will return false (definitely not in set)

Message permanent page