title: Time complexity of leetcode 561
body: <p>The questions is:
  Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as possible.</p>
  
  <p>The solution provided as:</p>
  
  <pre><code>public class Solution {
      public int arrayPairSum(int[] nums) {
          int[] arr = new int[20001];
          int lim = 10000;
          for (int num: nums)
              arr[num + lim]++;
          int d = 0, sum = 0;
          for (int i = -10000; i &lt;= 10000; i++) {
              sum += (arr[i + lim] + 1 - d) / 2 * i;
              d = (2 + arr[i + lim] - d) % 2;
          }
          return sum;
      }
  } 
  </code></pre>
  
  <p>I think it is unfair to say that the time complexity is O(n). Although, O(n+K) K = 20001 is a constant number which seems could be omitted, the n is also less than K. If so, why can't I say time complexity to be O(1)?</p>