CT008

Smallest Rotated Sigil

MediumAcceptance: 0.0%

The elder runesmith can manipulate a sigil-string by taking one of the first k letters and moving it to the end of the string, any number of times. Given a string of length n and an integer k, determine the lexicographically smallest string that can be created after an unlimited number of moves.

Example 1:

Input: daily 1
Output: ailyd

Example 2:

Input: cba 2
Output: abc

Constraints:

1 <= n <= 1000 1 <= k <= n String consists of lowercase English letters

Tags:

strings sorting
Loading...
Test Cases:No test cases
No test cases available.
Coding Problem Not Found | CodeTikki