title: How to return 2 indexes of a vector?
body: <p>I'm writing this program to find 2 numbers in a vector (the vector isn't sorted), so that its sum equal to the target sum. This is my program:</p>
  <pre><code>#include &lt;vector&gt;
  #include &lt;algorithm&gt;
  using namespace std;
  
  vector&lt;size_t&gt; find_numbers(const vector&lt;int&gt;&amp; nums, int target) 
  {
      sort(nums.begin(), nums.end()); // Sort the vector
  
      for (size_t i = 0; i &lt; nums.size(); ++i)
          if (binary_search(nums.begin(), nums.end(), target - nums[i]))
              return {i, ?}; // How to return the second number's position?
  
      return {};
  }
  </code></pre>
  <p>If I add another loop to find the second number's position, the running time will be O(n^2), I want my program to run in O(nlogn). How can I return the second number's position?</p>