899-Orderly-Queue
Sat 17 May 2025
https://leetcode.com/problems/orderly-queue
import pyutil as pyu
pyu.get_local_pyinfo()
print(pyu.ps2("python-dotenv"))
from typing import List
class Solution:
def orderlyQueue(self, S: str, K: int) -> str:
return ''.join(sorted(S)) if K > 1 else min(S[i:] + S[:i] for i in range(len(S)))
new Solution().orderlyQueue()
Score: 5
Category: leetcode