<p>You are given a string <code>num</code> representing <strong>the digits</strong> of a very large integer and an integer <code>k</code>. You are allowed to swap any two adjacent digits of the integer <strong>at most</strong> <code>k</code> times.</p>

<p>Return <em>the minimum integer you can obtain also as a string</em>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2020/06/17/q4_1.jpg" style="width: 500px; height: 40px;" />
<pre>
<strong>Input:</strong> num = &quot;4321&quot;, k = 4
<strong>Output:</strong> &quot;1342&quot;
<strong>Explanation:</strong> The steps to obtain the minimum integer from 4321 with 4 adjacent swaps are shown.
</pre>

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

<pre>
<strong>Input:</strong> num = &quot;100&quot;, k = 1
<strong>Output:</strong> &quot;010&quot;
<strong>Explanation:</strong> It&#39;s ok for the output to have leading zeros, but the input is guaranteed not to have any leading zeros.
</pre>

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

<pre>
<strong>Input:</strong> num = &quot;36789&quot;, k = 1000
<strong>Output:</strong> &quot;36789&quot;
<strong>Explanation:</strong> We can keep the number without any swaps.
</pre>

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

<ul>
	<li><code>1 &lt;= num.length &lt;= 3 * 10<sup>4</sup></code></li>
	<li><code>num</code> consists of only <strong>digits</strong> and does not contain <strong>leading zeros</strong>.</li>
	<li><code>1 &lt;= k &lt;= 10<sup>9</sup></code></li>
</ul>

from sortedcontainers import SortedList

class Solution:
    def minInteger(self, num: str, k: int) -> str:
        # Initialize the size of the number and a sorted list to maintain a window
        sz = len(num)
        window = SortedList()
        
        # Create a sorted list of indices and a list to store the indices of the popped elements
        remainedIndices = SortedList(range(sz))
        poppedIndices = []
        
        # Continue the process until we have swaps left
        while k > 0:
            # Expand the window to include up to k+1 elements or the remaining indices
            while len(window) < k + 1 and len(window) < len(remainedIndices):
                idx = remainedIndices[len(window)]
                window.add((num[idx], idx))
            
            # If the window is empty, break out of the loop
            if not window:
                break
            
            # Pop the smallest element from the window
            index = window.pop(0)[1]
            
            # Calculate the number of swaps used to bring this element to the front
            k -= remainedIndices.bisect_left(index)
            
            # Remove the index from the remaining indices and add it to the popped indices
            remainedIndices.remove(index)
            poppedIndices.append(index)
            
            # Remove elements from the window that are beyond the current k limit
            for idx in remainedIndices[k + 1: len(window)]:
                window.remove((num[idx], idx))
        
        # Create a set of popped indices for quick lookup
        poppedSet = set(poppedIndices)
        
        # Construct the result by combining the popped elements and the remaining elements
        return "".join(num[idx] for idx in poppedIndices) + "".join(num[idx] for idx in range(sz) if idx not in poppedSet)

# Explanation:
# 1. We maintain a window of size up to k+1 using a sorted list to efficiently find the smallest element.
# 2. We pop the smallest element from the window, which represents the smallest digit we can bring to the front.
# 3. We adjust k by the number of swaps needed to bring this element to the front.
# 4. We remove this element from the list of remaining indices and add it to the list of popped indices.
# 5. We continue this process until we run out of swaps (k becomes 0).
# 6. Finally, we construct the result by combining the digits in the order they were popped and the remaining digits.
23300