Last one: Write down the code for a method which takes an array and a number K as input s and returns the (Any) pair of numbers from that array whose sum is K. (I asked multiple times if he wants only one pair or all the pairs).
Sigiloso
List getKSumPair(int arr[],int K) { List pair= new ArrayList(); for (int i = 0; i < arr.length; i++) { for (int j = i + 1; j < arr.length; j++) { if (arr[i] + arr[j] == K) { pair.add(arr[i]); pair.add(arr[j]); i= arr.length; j= arr.length; } } } return pair; }