The program below accept two array with hole pozitive nums, with same size N, and fill empty array "c" with nums of "a" that do not exist in "b" and return the biggest num of "a" that do not exist in "b".

qustion: how to do write this method with more efficiency ?

Code Java:

public int f(int[]a, int[]b, int[] c) { int N = a.length; int j, max = 0, g = 0, t = 0; for(int i=0; i < N; i++) { for(j=0; j<N; j++) if(b[j] == a[i]) // if find the num in "b" go to the next num in "a" break; if(j == N) { c[t] =a[i] // fill empty array "c" with nums of "a" that do not exist in "b" if(g ==0 || c[t] > max) { max = c[t]; // remmber the max num in "max" g = 1; } t++; } } return max; // max of "a" that you do not have in "b"