FiddleComputers

Coding interview 1 - C++ function

Oct 17th, 2020
536
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×