Skip to content

Instantly share code, notes, and snippets.

@PeculiarE
Created March 2, 2026 22:58
Show Gist options
  • Select an option

  • Save PeculiarE/d7e5df11fe32de08937aa76b935a192d to your computer and use it in GitHub Desktop.

Select an option

Save PeculiarE/d7e5df11fe32de08937aa76b935a192d to your computer and use it in GitHub Desktop.
Intersection of Two Arrays - LeetCode - Day 61

Question

Intuition

Approach

Complexity

  • Time complexity: $$O(n + m)$$

  • Space complexity: $$O(n + m)$$

Code

class Solution:
    def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]:
        return list(set(nums1) & set(nums2))
        

Result

Screenshot 2026-03-02 at 22 55 34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment