in reply to Print max count of repeated consecutive numbers in an array
As the elements in your input array are counted consecutively, you can avoid the use of a hash and only need the count of the element and the value of the counted element. Maybe this is what your teacher mentions as feedback.
Instead of using the hash, you can use simply the $prev_key variable and maybe introduce a variable $repeat_count instead of the count stored in %count.
|
|---|