Edabit Java: Determine If Two Numbers Add up to a Target Value, Medium Difficulty
- Justin Mah
- Apr 7, 2021
- 1 min read
Solving this question in Edabit: https://edabit.com/challenge/KSX8nW7H... using a nested for loop to see if the sum matches the int value


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;
}
}
Comments