|
|
|
|
|
by epicureanideal
5371 days ago
|
|
Also, this solution isn't the most efficient because again you're searching the whole string potentially every iteration of your inner loop. So you've got an O(n^2) algorithm when it could be an O(n) algorithm. If we're dealing with just a short string, fine, but if the string were tens of thousands of characters long and we had thousands of lines, this might star to become significant. Sure, we're not likely to be given that. Maybe I read too much into these problems, but if they're going to give this as a test I assume they actually want to test something like efficiency, readability, etc. |
|