You are viewing a single comment's thread. Return to all comments →
static String twoArrays(int k, int[] A, int[] B) { Arrays.sort(A); Arrays.sort(B); int i=0; int j=B.length-1; int sum=0; int flag=0; while(i<A.length-1 && j>0){ sum = A[i] + B[j]; System.out.println(sum+ " sugandh "); if(sum >= k){ flag = 1; }else{ flag=0; break; } i++; j--; } if(flag == 1){ return "YES"; }else{ return "NO"; } }
Seems like cookies are disabled on this browser, please enable them to open this website
Permuting Two Arrays
You are viewing a single comment's thread. Return to all comments →