作者parywu (一个会写程式的人)
看板perl
标题Re: [问题] get the same elements
时间Sat Apr 19 03:25:30 2003
※ 引述《easy1 ( ~_~ !)》之铭言:
: @a = qw/a b c d e f/;
: @b = qw/a c g h f d b/;
: how can I get the same elements in @a and @b ?
@c = grep { +{map { ($_,1)} @a}->{$_} } @b; # O(2n*log(n))
--
Pary All Rough Yet.
--
※ 发信站: 批踢踢实业坊(ptt.csie.ntu.edu.tw)
◆ From: 61.64.145.132