Determine the intersection of two sets of input integer arrays.
- Design and implement a method that takes two integer arrays and returns their intersection. The two input arrays have non repeating elements. The array returned should not have repeating elements.
- Share and explain the time and space complexities for your solution in the comments above the method.
- If the complexity is defined in terms of n and m, explain what n and m stand for.
- If you think of multiple approaches to solve the problem, implement the solution which minimizes space complexity. Explain the other approaches, and your decision in comments above the code.
- For example,
- intersection of [2, 3, 4] and [4, 5, 6] is [4]
- intersection of [50, 43, 25, 72] and [25, 36, 43, 50, 80] is [50, 25, 43]
- intersection of [9, 30, 42] and [56, 34, 90, 32] is []
Note: Do not use Ruby provided methods.