mirror of
https://github.com/TheAlgorithms/Ruby
synced 2025-01-14 08:01:05 +01:00
Minor changes
This commit is contained in:
parent
d6e7b9f1d8
commit
745b66227b
1 changed files with 10 additions and 9 deletions
|
@ -32,11 +32,12 @@ def arrays_intersection(arr1, arr2, arr3)
|
|||
add_to_hash(arr2, hash)
|
||||
add_to_hash(arr3, hash)
|
||||
|
||||
hash.select { |key, value| value == 3 }.keys
|
||||
hash.select { |_key, value| value == 3 }.keys
|
||||
end
|
||||
|
||||
def add_to_hash(arr, hash)
|
||||
arr.each_with_index do |value, index|
|
||||
arr.count.times do |pointer|
|
||||
value = arr[pointer]
|
||||
hash[value] += 1
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue