fork download
  1. class GFG
  2. {
  3.  
  4. // Function to return the required XOR
  5. public static int computeXor(int[] A, int[] B) {
  6. int xora = 0, xorb = 0;
  7. for (int a: A)
  8. xora = xora & a;
  9. for (int b: B)
  10. xorb =xorb & b;
  11. return xora ^ xorb;
  12. }
  13.  
  14. // Driver code
  15. public static void main(String args[])
  16. {
  17. //int a = 1, b = 2 , c=3 , d=4;
  18. int A[] = {1,2};
  19. int B[] = {3,4};
  20.  
  21. System.out.println(computeXor(A,B));
  22. }
  23. }
Success #stdin #stdout 0.08s 47024KB
stdin
Standard input is empty
stdout
0