Here shows 5 Approaches to slove this problem: Brute Force use \(\texttt{Long}\) , Brute Force use \(\texttt{Int}\) , Binary Search use \(\texttt{Long}\) , Binary Search use \(\texttt{Int}\) and Recursion.
Intuition
To divide two integers without using multiplication, division, and mod operator, so we can subtract the \(\textit{divisor}\) from the \(\textit{dividend}\) util the \(\textit{result} \ge 0\) .
Brute Force use Long
We can make the \(\textit{dividend}\) and \(\textit{divisor}\) positive, and cast to \(\texttt{long}\), then process.
We can use \(\texttt{HashSet}\) to record the distinct integers of the two arrays and judge whether a distinct integer in \(\textit{nums}_1\) which not present in \(\textit{nums}_2\).
We can only use \(2\)\(\texttt{HashSet}\), not \(4\)\(\texttt{HashSet}\).