If we hash either, a or b, we always will lose somethingTake 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
In reply to Re2: (OT) Interview questions -- your response?
by blakem
in thread (OT) Interview questions -- your response?
by Ovid
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |