Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Print max count of repeated consecutive numbers in an arrayby Corion (Patriarch) |
on Oct 06, 2021 at 12:47 UTC ( [id://11137257]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Seekers of Perl Wisdom
|
|