Problem 7
Write a function, named mostRepeated , that take a vector as input arguments, and output the number(s) that is/are repeated consecutively most often. For example, if you have
a = [1 2 2 2 1 3 2 1 4 5 1];
mostRepeated(a)
The answer would be 2 , because it shows up three consecutive times.
Other examples:
# example 1
Input: [1 1 1 2 2 2 3 3 3]
Output: [1 2 3]
# example 2
Input: [0 1 1 1 0 2 2 0 1 1 1 0]
Output: [1 1]
# example 3
Input: [1 2 3 4 5]
Output: [1 2 3 4 5]