Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int findKComplementary(int[] A, int K)
- {
- int count = 0;
- for(int i = 0; i < A.length; i++) {
- for (int j = i; j < A.length; j++ ) {
- if (A[ i ] + A[ j ] == K ) {
- if ( i != j ) count += 2;
- else count++;
- }
- }
- }
- return count;
- }
Add Comment
Please, Sign In to add comment