content: class Solution {
      private void countingSort(int[] arr) {
          // Create the counting hash map.
          HashMap<Integer,Integer> counts = new HashMap<>();
          int minVal = arr[0], maxVal = arr[0];
          
          // Find the minimum and maximum values in the array,
          // and update it's count in the hash map.
          for (int i = 0; i < arr.length; i++) {
              minVal = Math.min(minVal, arr[i]);
              maxVal = Math.max(maxVal, arr[i]);
              counts.put(arr[i], counts.getOrDefault(arr[i], 0) + 1);
          }
          
          int index = 0;
          // Place each element in its correct position in the array.
          for (int val = minVal; val <= maxVal; ++val) {
              // Append all 'val's together if they exist.
              while (counts.getOrDefault(val, 0) > 0) {
                  arr[index] = val;
                  index += 1;
                  counts.put(val, counts.get(val) - 1);
              }
          }
      }
  
      public int[] sortArray(int[] nums) {
          countingSort(nums);
          return nums;
      }
  }