Scrabble -------- This was probably the most straightforward problem on the competition but the blanks do make it a little tricky. After reading in all the words in the dictionary and the tiles you have, you need to check whether each word can be formed with your tiles. So how do you figure out whether a word can be formed with a given set of tiles? Let's forget about blanks for a while. You can make a word like "BANANA" if and only if you have at at least 3 "A" tiles, at least 1 "B" tile, and at least 2 "N" tiles. This suggests the following algorithm: count the number of times each letter appears in the word, and count the number of times each letter appears in your tiles. If you always have as many tiles as you need, the word can be formed. Otherwise, it cannot. Now, what happens when you include blanks? It turns out this does not make the problem much harder. If you want to spell "BANANA" and you have 3 "B" tiles, 1 "A" tile, and 1 "N" tile, then following the above method, you can see that you are missing 3 tiles: 2 "A"'s, and 1 "B". Thus, you can spell "BANANA" if and only if you have 3 blank tiles to compensate for the 3 tiles you are missing. In general, if you ever have more of a specific letter in the word than in the tiles, you add the difference to a numberOfMissingTiles counter. Then, the word can be spelled if and only if you have at least one blank for each missing tile. C++ code is shown below. int count = 0; for (i = 0; i < words.size(); i++) { vector wordFreq(256, 0), tilesFreq(256, 0); for (j = 0; j < words[i].size(); j++) wordFreq[words[i][j]]++; for (j = 0; j < tiles.size(); j++) tilesFreq[tiles[j]]++; int blanks = tilesFreq['_'], numberOfMissingTiles = 0; for (j = 'A'; j <= 'Z'; j++) if (wordFreq[j] > tilesFreq[j]) numberOfMissingTiles += wordFreq[j] - tilesFreq[j]; if (blanks >= numberOfMissingTiles) count++; } cout << count << endl;