4 ms·
If all they expect are passing test cases, then just use canned values in your code to make the tests pass. This is way more performant and even more efficient
by d0liver 4y ago
If all they expect are passing test cases, then just use canned values in your code to make the tests pass. This is way more performant and even more efficient to write.
- teraflop 4y agoPart of the point of this style of challenge is that you're not given all of the test cases up front. And even if you are, you generally can't come up with those "canned values" without actually figuring out an algorithmic solution. As I said, some of the test cases for this particular problem can be strings up to 100,000 characters long. Do you really think it's faster to solve those by hand than to come up with a correct algorithm to do it for you?