Written in C# using Linq to SQL


  • 0
    H
    public class Solution {
        public int[] Intersection(int[] nums1, int[] nums2) {
            return   (from num1 in nums1
                      from num2 in nums2
                      where num1 == num2
                      select num1).Distinct().ToArray();
        }
    }
    

    Of course it runs perfectly right but slow
    768ms to pass 60 cases
    are you kidding me?


Log in to reply
 

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