
Answer:
Complete code is given below:
Explanation:
First counts dictionary is intitalized empty. Then, traversing the checkpoints list, count of each character is stored in counts dictionary.
Then, value of dictionary are iterated and maximum count is stored in res variable and returned.
Code:
def max_checkpoint(checkpoints):
counts = {}
Â
for i in checkpoints:
if i not in counts:
counts[i] = 1
else:
counts[i] = counts[i]+1
Â
res = 0
Â
for v in counts.values():
if(v>res):
res = v
Â
return res
print(max_checkpoint(['c', 'g', 'e', 'a', 'd', 'b', 'a', 'f', 'g', 'd']))
print(max_checkpoint(['n', 's', 's', 't', 's', 'n', 's', 'o']))
print(max_checkpoint(['a', 'b', 'c', 'd', 'c', 'd', 'e', 'b', 'd', 'a', 'e', 'f']))
print(max_checkpoint(['p', 'o', 'y', 'p']))
print(max_checkpoint(['z', 'z', 'z', 'z']))