in reply to Better way of writing "find the missing number(s)"

In the spirit of TIMTOWTDI :)

#!/usr/bin/perl # http://perlmonks.org/?node_id=1186862 use strict; use warnings; my @arr = (19,17,22,23,24,15,16,25..35); my @sorted = sort {$a <=> $b} @arr; my @missing = map { $sorted[$_ - 1] + 1 .. $sorted[$_] - 1 } 1 .. $#so +rted; print "missing numbers are @missing\n";

Replies are listed 'Best First'.
Re^2: Better way of writing "find the missing number(s)"
by Discipulus (Canon) on Apr 03, 2017 at 20:52 UTC
    eh! bravo as always tybalt89 but stop beating me on time (as well as in quality..)!

    ;=)

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.