This solution works on my local machine but on the judge this returns a completely wrong solution. Has this happened with anyone ? I am very confused please help.

```
class Solution:
def largestNumber(self, nums):
for i in range(1, 20):
noHits = True
countingSort = [[] for i in range(0, 10)]
modifiedIdx = set()
for idx, n in enumerate(nums):
strVal = str(n)
digitStr = None
if i <= len(strVal):
digitStr = strVal[-i]
if digitStr:
digit = int(digitStr)
countingSort[digit].append(idx)
modifiedIdx.add(idx)
noHits = False
if noHits:
break
ordering = []
for i in range(9, -1, -1):
for j in countingSort[i]:
ordering.append(j)
buffer,c = [],0
for i in range(0, len(nums)):
if i in modifiedIdx:
buffer.append(nums[ordering[c]])
c += 1
else:
buffer.append(nums[i])
nums = copy.deepcopy(buffer)
result = ""
for num in nums:
result += str(num)
return result
```