Hi I'm a university student and I have to do a program. given a list of letters I have to say which is the length of the longest sequence. for example if I have the following list ["C", "A", "G", "G", "G", "T", "A", "C", "A", "A",] the solution that I have to find is the following 3, "G" as the G has been repeated 3 times in a row. could someone help me? thank you
i need for university
You could use a collection.Counter as following:
Now you could print counter to see the ordered list:
And the result will be:
Or you can also query a specific key to know the get the count: