← AlgoMindset 75

Find the Difference of Two Arrays

Easy🎙 Interview me on this

🧠 Before you code — what pattern fits?

Given two integer arrays nums1 and nums2, return a list answer of size 2 where answer[0] is a list of all distinct integers in nums1 not present in nums2, and answer[1] is a list of all distinct integers in nums2 not present in nums1.

([1,2,3],[2,4,6]) → [[1,3],[4,6]]

🎬 Video explanation · NeetCodeIO

Your solution runs against 2 unit tests, including edge and large-value cases.

Loading...

Test console · 2 unit tests

Submit your code to run it against all 2 unit tests. Results appear here.

JavaScript, TypeScript & Python run sandboxed in your browser; other languages run on the execution server. Your code is saved locally as you type.