Advertisement
Guest User

Untitled

a guest
Dec 16th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. class Solution
  2. {
  3. public:
  4. vector<int> twoSum(vector<int>& nums, int target)
  5. {
  6. vector<int> indices;
  7.  
  8. for(size_t i = 0; i < nums.size(); ++i)
  9. {
  10. for(size_t j = i + 1; j < nums.size(); ++j)
  11. {
  12. if(nums[i] + nums[j] == target)
  13. {
  14.  
  15. indices.push_back(i);
  16. indices.push_back(j);
  17.  
  18. return indices;
  19. }
  20. }
  21. }
  22.  
  23. return indices;
  24. }
  25. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement