#i have 2 arrays lets call it A and B and i want an extra array that outputs the difference
1 messages · Page 1 of 1 (latest)
Hey, @little zinc!
Please remember to /close this post once your question has been answered!
are both arrays sorted ?
Create a third array with the length of both arrays combined (Worst case no elements are equal to one another). Then use a for loop to traverse both arrays at the same time. If one of them has a greater value than the other copy all elements into the newly created third array. If you reach the end of one array put all remaining elements of the other array in your third array
If you've done the previous ones with collections, I supposed you've used retainAll()
Now it's time for removeAll()
thank you