Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Print max count of repeated consecutive numbers in an array

by Corion (Patriarch)
on Oct 06, 2021 at 12:47 UTC ( [id://11137257]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11137257]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (6)
As of 2024-04-19 07:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found