Guest User

Untitled

a guest
Mar 22nd, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. public int findKComplementary(int[] A, int K)
  2. {
  3. int count = 0;
  4. for(int i = 0; i < A.length; i++) {
  5. for (int j = i; j < A.length; j++ ) {
  6. if (A[ i ] + A[ j ] == K ) {
  7. if ( i != j ) count += 2;
  8. else count++;
  9. }
  10. }
  11. }
  12. return count;
  13. }
Add Comment
Please, Sign In to add comment