title: How Can I fix the following Error in leetcode?
body: <p>For the question:
  Given an array of integers nums, return the number of good pairs.</p>
  <p>A pair (i, j) is called good if nums[i] == nums[j] and i &lt; j.</p>
  <p>I wrote the following code:</p>
  <pre><code> int numIdenticalPairs(vector&lt;int&gt;&amp; nums) {
     
   int count[102];
  
  for (int num : nums) {
    count[num]++;
  }
  
  int totalCount = 0;
  
  // Calculate total number of pairs possible
  for (int i : count) {
    totalCount += ((i) * (i-1))/2;
  }
  
  return totalCount;
  </code></pre>
  <p>}</p>
  <p>I am getting following error help me fix it:</p>
  <blockquote>
  <p>Line 21: Char 26: runtime error: signed integer overflow: -1844207608 * -1844207609 cannot be represented in type 'int' (solution.cpp)
  SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior prog_joined.cpp:30:26</p>
  </blockquote>