title: C++ - Find sum of unique elements
body: <p>I am trying to get the sum of unique elements, however I am not meeting the requirements of the given output.</p>
  <pre><code>//Prompted Input: [1,2,3,2]
  //Expected output: 4
  //Explanation: The unique elements are [1,3]
  </code></pre>
  <p>Below is my relevant code. Some things I have tried was to set j to i for the nested loop, however that changed nothing. The next step I took was to take out the first if conditional and have the code do the sum after finding the unique numbers but the output was 10. I'd be grateful if someone could give me a direction of where I'm messing up because I know I am close.</p>
  <pre><code>int sumOfUnique(vector&lt;int&gt;&amp; nums) {
  
          int sum = 0;
          for(int i = 0; i &lt; nums.size(); i++){
              for(int j = 0; j &lt; nums.size(); j++){
                  if(j == i){
                      sum += nums[i];
                  }
                  if(nums[i] == nums[j]){
                      break;
                  }
              }
                  
          }    
          return sum;
      }
  </code></pre>