One line code in Java using lambda


  • 2
    L
    return Arrays.stream(nums1).distinct().filter(p->{return Arrays.stream(nums2).anyMatch(q->{return q==p;});}).toArray();

Log in to reply
 

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