<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> and an integer <code>value</code>.</p>

<p>In one operation, you can add or subtract <code>value</code> from any element of <code>nums</code>.</p>

<ul>
	<li>For example, if <code>nums = [1,2,3]</code> and <code>value = 2</code>, you can choose to subtract <code>value</code> from <code>nums[0]</code> to make <code>nums = [-1,2,3]</code>.</li>
</ul>

<p>The MEX (minimum excluded) of an array is the smallest missing <strong>non-negative</strong> integer in it.</p>

<ul>
	<li>For example, the MEX of <code>[-1,2,3]</code> is <code>0</code> while the MEX of <code>[1,0,3]</code> is <code>2</code>.</li>
</ul>

<p>Return <em>the maximum MEX of </em><code>nums</code><em> after applying the mentioned operation <strong>any number of times</strong></em>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> nums = [1,-10,7,13,6,8], value = 5
<strong>Output:</strong> 4
<strong>Explanation:</strong> One can achieve this result by applying the following operations:
- Add value to nums[1] twice to make nums = [1,<strong><u>0</u></strong>,7,13,6,8]
- Subtract value from nums[2] once to make nums = [1,0,<strong><u>2</u></strong>,13,6,8]
- Subtract value from nums[3] twice to make nums = [1,0,2,<strong><u>3</u></strong>,6,8]
The MEX of nums is 4. It can be shown that 4 is the maximum MEX we can achieve.
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> nums = [1,-10,7,13,6,8], value = 7
<strong>Output:</strong> 2
<strong>Explanation:</strong> One can achieve this result by applying the following operation:
- subtract value from nums[2] once to make nums = [1,-10,<u><strong>0</strong></u>,13,6,8]
The MEX of nums is 2. It can be shown that 2 is the maximum MEX we can achieve.
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= nums.length, value &lt;= 10<sup>5</sup></code></li>
	<li><code>-10<sup>9</sup> &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>
</ul>

class Solution:
    def findSmallestInteger(self, nums: List[int], value: int) -> int:
        reminderCount = {}
        for num in nums:
            remind = num%value
            if remind not in reminderCount:
                reminderCount[remind] = 0
            reminderCount[remind] += 1

        for i in range(0, 10**9):
           
            if i%value not in reminderCount or reminderCount[i%value] == 0:
                return i 
            else:
                reminderCount[i%value] -= 1
                
        
        return rangeVal+1



"""     0 1   2  3 4 5 
nums = [1,-10,7,13,6,8]
        1          1
value = 7
        
       [1,-4,0,6,6,1] -> 0, 6

       {-4,1,6,0}
       
       [1,0,2,3,1,2] -> 0 3

        {1,0,2,3}

       [0,-4,1,1,6,6]
        
        1 8
        
        2%7

1%7 = 1

value = 5

[1,0,2,3,1,3]
{1:2,0:1,2:1,3:2}

ans = 0

[1,2,3]

2

1+2 = 3
1-2 = -1


x%value = y

1%5 = 1
12%5 = 2

1-5 = -4+5 = 1

12-5 = 7-5 = 2

13%5 -> 3

[1,2,]


[3,0,3,2,4,2,1,1,0,4]


[3,0,3,2,4,2,1,1,0,4]
 |
 {3:1,0:1,4:1,2:0,1:1}


4%5
"""


34000