Skip to main content
2 events
when toggle format what by license comment
Dec 30, 2011 at 7:01 comment added Mike Nakis Doch! I thought of this, and then I thought that the time you'd spend building this tree would be larger than the time you'd spend to just answer the question the straightforward way, but now that I am thinking about it again, I realize this: your 'solve' function can save the prefix tree of each string it sees, so as to reuse it later if it gets invoked with the same string! And I'll bet you that they make the test last 5 seconds largely by feeding it the same string over and over again, instead of producing a new string every time.
Dec 29, 2011 at 23:47 history answered Winston Ewert CC BY-SA 3.0