top of page

Edabit Java: Determine If Two Numbers Add up to a Target Value, Medium Difficulty




public class SumUpToValue {

public static boolean sumOfTwo(int[] a, int[] b, int v) {

for(int i = 0; i < a.length; i++) {

for(int j = 0; j < b.length; j++) {

if(a[i] + b[j] == v)

return true;

}

}

return false;

}

}




5 views0 comments
Post: Blog2_Post
bottom of page