I continue doing LeetCode exercises. Worked on another "Medium" difficulty problem today. Seemed straightforward enough. Find the longest length of any substring in a specified string that does not have any duplicated characters.
This is my practice for C++. Therefore I am using the STL to get more experience with it. Store all substrings in a vector. Write a function to determine if a string has any dup chars using a map. This works for most of the one thousand test cases. But there are a few where LeetCode says my solution took too long.
LOL wut? Some test cases pass in a massive amount of text. I am enumerating all combinations of substrings in there. After I tighten up my code, I guess that my dup detector is just taking too long. Therefore I get rid of the STL map from it. Code is up with straight C arrays. Works fine.
Newbie Gets Confused
-
A relatively younger developer got tasked with doing some performance tests
on a lot of new code. First task was to get a lot of data ready for the new
c...