I've now tried a few times to check a value and then do something with its index in a function.
Challenge:
A fancy string is a string where no three consecutive characters are equal.
Given a string s, delete the minimum possible number of characters from s to make it fancy.
s = "leeetcode"
def fun():
for i, c in enumerate(s):
if c = c+1 = c+2:
remove()
I can't seem to properly digest how to correctly reference the index. I still have trouble with data structures. I need more exercises like this to get a feeling for it, have some repetition.
Is there some good way to remember how to do this thing, a good analogy maybe?