Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Answer: Find largest ordered sequence in an array

by blakem (Monsignor)
on Oct 04, 2001 at 05:05 UTC ( [id://116616]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my %list_o_num = map {
                             if(exists $list_o_num{$_})
    ...
                         }
                     @list_o_num;
    
  2. or download this
    my %list_o_num;
    $list_o_num{$_}++ for @list_o_num;
    ...
    my @true_top_3 = (sort { $b <=> $a } keys %list_o_num)[0..2];
    
    print "T3: ", join(', ',@true_top_3), "\n";
    
  3. or download this
    #!/usr/bin/perl -wT
    use strict;
    ...
                                @list_o_num)[0..2];
    
    print "T3: ", join(', ',@true_top_3), "\n";
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-03-29 09:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found