check if array of arrays contains some array
This question already has an answer here:
Ruby's #include?
method can be used here:
arr = [[1, 2], [3, 4], [4, 5]]
arr.include?([1, 2])
# => true
Hope this helps!
Just use bigarray.include? smallarray
bigarray.include? smallarray
. It's the same way you'd check for membership with any other list. Example
上一篇: 在Array中查找值
下一篇: 检查数组数组是否包含某个数组