SHARE
TWEET

Untitled

bbescos Jan 23rd, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3. #include <unordered_map>
  4.  
  5. using namespace std;
  6.  
  7. vector<int> find_indexes(const vector<int>& nums, int sum) {
  8.    
  9.     unordered_map<int, int> hashmap;
  10.    
  11.     for (int i = 0; i < nums.size(); ++i) {
  12.         int current = nums[i];
  13.         int complement = sum - nums[1];
  14.        
  15.         for (int j = i + 1; j < nums.size(); ++j) {
  16.         hashmap[i] = nums[i];
  17.         for (int j = i + 1; j < nums.size(); ++j) {
  18.             if hashmap.count()
  19.         }
  20.        
  21.         hashmap[current] = i;
  22.     }
  23.    
  24.    
  25.    
  26.     return result;
  27. }
  28.  
  29.  
  30. void print_vector(const vector<int>& vec) {
  31.     for (int i = 0; i < vec.size(); ++i) {
  32.         std::cout << vec[i] << std::endl;
  33.     }
  34. }
  35.  
  36. int main()
  37. {
  38.     vector<int> v1 = {1 ,1, 2 ,3 ,4 ,5 ,6 ,7 , 8}
  39.     int sum1 = 5;
  40.     vector<int> result1 = {0, 1, 3}
  41.     vector<int> output1 = find_indexes(v1, sum1);
  42.    
  43.     print_vector(result1);
  44.     print_vector(output1);
  45.     std:cout << "---------------" << std::endl;
  46.  
  47.     return 0;
  48. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top