Just for fun xD Java one line solution beats 0.6%

  • 1

    public static int[] intersection(int[] nums1, int[] nums2) {
    return IntStream.of(nums2).distinct().filter(IntStream.of(nums1).boxed().collect(Collectors.toSet())::contains).toArray();

    Ofc i can do it faster as all xD but it's not funny cuz problem is soooo easy ;)

Log in to reply

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