Longest Equal Run

In a stream of bytes, it can be useful to notice a long consecutive repeat of the same value. Given a list data, return the length of the longest contiguous run of equal elements. Count only values that appear next to each other, not the total number of equal bytes in the whole list. For an empty list, return 0.

Примеры

Ввод
[1, 1, 1, 2, 3, 3]
Вывод
3
Ввод
[144, 144, 144, 144]
Вывод
4
Ввод
[]
Вывод
0

Нужно реализовать

def longest_run(data):

Теги

arraylists
PostgreSQLv16

Siia ilmub koodi käivituse tulemus

Visible tests
1
Input
[1,1,1,2,3,3]
Expected3
2
Input
[144,144,144,144]
Expected4
3
Input
[]
Expected0
4
Input
[5]
Expected1
5
Input
[1,2,1,2,1]
Expected1
6
Input
[7,7,0,0,0,0,9]
Expected4
Focus radio
Paused · SomaFM · Fluid