Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Generating ranges of numbers

by Anonymous Monk
on Jun 30, 2016 at 10:09 UTC ( [id://1166922]=note: print w/replies, xml ) Need Help??


in reply to Generating ranges of numbers

Sounds like homework.

Can you describe the algorithm you would use in your own words?

But most importantly: Why is "1 2 3" turned into "1:3" but "5 6 7" turned into "5:6 7"? What rule does that follow?

Replies are listed 'Best First'.
Re^2: Generating ranges of numbers
by nandymamith (Novice) on Jun 30, 2016 at 14:32 UTC

    Sorry Monk, my mistake. The OUTPUT should be in the below format :

    OUTPUT @ranges = ("1:3","5:7","9");

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-04-20 00:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found