Marks :10
: 2 | : 1
Given a string $$$s$$$ of length $$$n$$$ and a positive integer k such that $$$1 \leq k \leq n$$$, find the lexicographically smallest string possible by reversing at most one substring of size $$$k$$$.
The first line of input consists of 2 space separated integers $$$-$$$ $$$n$$$ and $$$k$$$. $$$(1 \leq k \leq n \leq 10^3)$$$. The second line of input consists of a string of length $$$n$$$ consisting of lowercase Latin letters.
The output should consist a string of length $$$n$$$ - the lexicographically smallest string possible by reversing at most one substring of size $$$k$$$.
6 2 aadcb
aacdb
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.