Advertisement
FiddleComputers

Coding interview 1 - C++ function

Oct 17th, 2020
650
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.20 KB | None | 0 0
  1. bool addUp(vector<int> array, int k)
  2. {
  3.     for(int i = 0; i < array.size(); i++)
  4.     {
  5.         for(int j = i+1; j < array.size(); j++)
  6.         {
  7.             if(array[i] + array[j] == k) return true;
  8.         }
  9.     }
  10.  
  11.     return false;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement