fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. int arr[] = {1,4,2,1};
  14. int arr2[] = {4,2,3};
  15.  
  16. int n1 = arr.length;
  17. int n2 = arr2.length;
  18. int count = 0;
  19. for(int i =0;i<n2;i++){
  20. for(int j =0;j<n1;j++){
  21. if(arr2[i] == arr[j]){
  22. count++;
  23. }
  24. }
  25. }
  26. if(count == n2){
  27. System.out.println("It is a subset");
  28. }
  29. else{
  30. System.out.println("It is not a subset");
  31. }
  32. }
  33. }
Success #stdin #stdout 0.1s 54268KB
stdin
Standard input is empty
stdout
It is not a subset