From b101ef25d7aec58f631293f0ff91c355c298120a Mon Sep 17 00:00:00 2001 From: Vitor Oliveira Date: Thu, 15 Apr 2021 18:00:29 -0700 Subject: [PATCH] Update and rename arrays_intersection.rb to sorted_arrays_intersection.rb --- ...arrays_intersection.rb => sorted_arrays_intersection.rb} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename data_structures/arrays/{arrays_intersection.rb => sorted_arrays_intersection.rb} (90%) diff --git a/data_structures/arrays/arrays_intersection.rb b/data_structures/arrays/sorted_arrays_intersection.rb similarity index 90% rename from data_structures/arrays/arrays_intersection.rb rename to data_structures/arrays/sorted_arrays_intersection.rb index c9780e0..a48a7c2 100644 --- a/data_structures/arrays/arrays_intersection.rb +++ b/data_structures/arrays/sorted_arrays_intersection.rb @@ -28,7 +28,7 @@ # @param {Integer[]} arr2 # @param {Integer[]} arr3 # @return {Integer[]} -def arrays_intersection(arr1, arr2, arr3) +def sorted_arrays_intersection(arr1, arr2, arr3) result = [] # prepare three pointers to iterate through three arrays @@ -57,11 +57,11 @@ end arr1 = [1, 2, 3, 4, 5] arr2 = [1, 2, 5, 7, 9] arr3 = [1, 3, 4, 5, 8] -print(arrays_intersection(arr1, arr2, arr3)) +print(sorted_arrays_intersection(arr1, arr2, arr3)) # Output: [1,5] arr1 = [197, 418, 523, 876, 1356] arr2 = [501, 880, 1593, 1710, 1870] arr3 = [521, 682, 1337, 1395, 1764] -print(arrays_intersection(arr1, arr2, arr3)) +print(sorted_arrays_intersection(arr1, arr2, arr3)) # Output: []