Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
[1, 2, 3] & [2, 3, 4]给了我们[2, 3]但是你如何得到n个数组的交集?
[1, 2, 3] & [2, 3, 4]
[2, 3]
[[1, 2, 3], [2, 3, 4], [1, 3, 4]].something会给[3]
[[1, 2, 3], [2, 3, 4], [1, 3, 4]].something
[3]
循环&工作,但必须有更好的方法。
&
[[1, 2, 3], [2, 3, 4], [1, 3, 4]].inject(:&) #=> [3]
只是&所有数组。假设您有 3 个数组。
a = [1,2,3] b = [2,3,4] c = [3,4,5] a & b & c => [3]
当我尝试执行一些 GIT 命令时(我仍然是 GIT 的新手),我注意到我所有的文件都<<HEAD----在其中。现在,我做了什么来删除它们,我手动转到所有文件以删除它们<<HEAD ----
<<HEAD----
<<HEAD ----
现在发生的情况是,即使我删除了这些<<HEAD ---,我现在也收到 500 内部服务
<<HEAD ---