Skip to content

Instantly share code, notes, and snippets.

@mfifth
Created March 2, 2019 19:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfifth/70a7e77ba2da16412d473000bca1f18f to your computer and use it in GitHub Desktop.
Save mfifth/70a7e77ba2da16412d473000bca1f18f to your computer and use it in GitHub Desktop.
So what you would do is find any letters within the string that show up at least twice. From there you look at the next letter beside it and save that in some sort of entry. That is the substring to beat. Then you run through the rest of the letters to see if anything can beat that record.
You do that so on and so forth until you reach the end of your substrings and then return the longest one the program found.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment