How can I efficiently check to see whether all the elements in an integer array are subset of all elements of another Array in java? For example [33 11 23] is subset of [11 23 33 42]. Thanks in advance.
If you're not bound to using Arrays, any Java collection has the containsAll method:
containsAll
boolean isSubset = bigList.containsAll(smallList);
This will do exactly what you want, efficiently.
2.1m questions
2.1m answers
60 comments
57.0k users