3 ms·
This question is annoying because it is simple to state, but it's a pain to implement. The naive solution is so stupid I'd physically feel bad to write it. The
by d--b 4y ago
This question is annoying because it is simple to state, but it's a pain to implement. The naive solution is so stupid I'd physically feel bad to write it.
The trie/reversed-trie solution is a little too clever to arise naturally from conversation (and probably not optimal because hardware implementation).