Code Golf: Longest 3-character substring
Started: 1576368000, F jS, Y g:i:s A
Ends: 1576972800, F jS, Y g:i:s A
Time Remaining: Ended!
Description
Write a function called burrito that takes in a string and returns a contiguous substring within that string. This substring should be the longest possible substring that contains at most 3 unique characters.
>>> burrito("abcdcdfdb")
"cdcdfd"
>>> burrito("mississippi")
"ississippi"
>>> burrito("a b c b a")
" b c b "
>>> burrito("cat")
"cat"
"cdcdfd"
>>> burrito("mississippi")
"ississippi"
>>> burrito("a b c b a")
" b c b "
>>> burrito("cat")
"cat"
Note that the string can contain any type of character, not just letters.
If there is a tie, you can return any valid answer (no verification tests will have ambiguous input)
The string will always be non-empty
You must be logged in to submit an entry.
Submission Queue
Your best Python entry so far
No entries submitted for the current language.Current Ranking
Python
| #1 | Kylljoy | 91 bytes |
| #2 | fwip | 96 bytes |
| #3 | Hydrogen | 107 bytes |
| #4 | Blake | 195 bytes |