Concise c# solution


  • 0
    M
    public class Solution {
        public int[] Intersection(int[] nums1, int[] nums2) {
            var set1 = new HashSet<int>(nums1);
            return nums2.Where(n => set1.Remove(n)).ToArray();
        }
    }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.