I have the following list:
[0, 1, 2, 3, 4, 6, 6, 17, 16, 9, 10, 23, 12, 13, 14, 15, 16, 17, 18, 4, 20, 4, 22, 23, 24, 4, 4]
I wanted to know how to find the number with the most repetitions without having to use a cycle since I do not see it very practical, especially with very long lists.
My idea was to use a dictionary whose elements have those in the list and that here if you check the number with higher repetitions using a for, however it is a process that can be very long but can be effective; and the last idea was to use the count
function in the one cycle that reviews each element of the set in the list.
Is there a more effective way to solve this problem? Any ideas?
Thanks!