2013-04-30 56 views

回答

8
[[1, 2, 3], [2, 3, 4], [1, 3, 4]].inject(:&) #=> [3] 
0

只是&所有陣列。假設你有3個數組。

a = [1,2,3] 
b = [2,3,4] 
c = [3,4,5] 

a & b & c 
=> [3]