daily pastebin goal
83%
SHARE
TWEET

Untitled

a guest Jan 20th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Finder {
  2.     static int MissingElement(int[] array, int[] array2) {
  3.         int x = 0, counter = 0;
  4.         for (int i = 0; i < array.length; i++) {
  5.             if (counter == 1) { break; }
  6.             x = array[i];
  7.             for (int j = 0; j < array2.length; j++) {
  8.                 if (x == array2[j]) { counter = 2; break; } else  { counter = 1; }
  9.             }
  10.         } return x;
  11.     }
  12.  
  13.  public static void main (String[] args) {
  14.      int[] array = {4, 8, 12, 9, 3};
  15.      int[] array2 = {4, 8, 9, 3};
  16.      System.out.println("Missing element: " + Finder.MissingElement(array, array2));
  17.   }
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top