java.lang.Object
g2201_2300.s2248_intersection_of_multiple_arrays.Solution

public class Solution extends Object
2248 - Intersection of Multiple Arrays.<p>Easy</p> <p>Given a 2D integer array <code>nums</code> where <code>nums[i]</code> is a non-empty array of <strong>distinct</strong> positive integers, return <em>the list of integers that are present in <strong>each array</strong> of</em> <code>nums</code> <em>sorted in <strong>ascending order</strong></em>.</p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> nums = [[<strong>3</strong> ,1,2, <strong>4</strong> ,5],[1,2, <strong>3</strong> , <strong>4</strong> ],[<strong>3</strong> , <strong>4</strong> ,5,6]]</p> <p><strong>Output:</strong> [3,4]</p> <p><strong>Explanation:</strong></p> <p>The only integers present in each of nums[0] = [<strong>3</strong> ,1,2, <strong>4</strong> ,5], nums[1] = [1,2, <strong>3</strong> , <strong>4</strong> ], and nums[2] = [<strong>3</strong> , <strong>4</strong> ,5,6] are 3 and 4, so we return [3,4].</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> nums = [[1,2,3],[4,5,6]]</p> <p><strong>Output:</strong> []</p> <p><strong>Explanation:</strong></p> <p>There does not exist any integer present both in nums[0] and nums[1], so we return an empty list [].</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= nums.length <= 1000</code></li> <li><code>1 <= sum(nums[i].length) <= 1000</code></li> <li><code>1 <= nums[i][j] <= 1000</code></li> <li>All the values of <code>nums[i]</code> are <strong>unique</strong>.</li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • intersection

      public List<Integer> intersection(int[][] nums)