http://www.perlmonks.org?node_id=196584


in reply to Re: (OT) Interview questions -- your response?
in thread (OT) Interview questions -- your response?

If we hash either, a or b, we always will lose something
Take another look at Abigail-II's solution and note that the question specifically states that the order of the results is unimportant.
#!/usr/bin/perl -wT use strict; my @a_array = qw( a c f r f z t ); my @b_array = qw( e c s f r f) ; my %b_hash; $b_hash {$_} ++ for @b_array; my @c_array = map {($_) x ($b_hash {$_} || 0)} @a_array; print "@c_array\n"; __END__ c f f r f f

-Blake

Replies are listed 'Best First'.
Re: Re2: (OT) Interview questions -- your response?
by seeken (Novice) on Sep 14, 2002 at 05:04 UTC
    Well if there was one thing I should have learned in school, it was to read the danged question all the way through.

    surfing the net and other cliches....