Created
February 25, 2021 10:01
-
-
Save Kakarot-2000/f1b49c9f167f27480aa289b2d4707f55 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string fun1(string s,int k){ | |
if(k>1){ | |
sort(s.begin(),s.end()); | |
return s; | |
} | |
string res=s; | |
for(int i=0;i<s.length();i++){ | |
char ch=s[0]; | |
s.erase(s.begin(),s.begin()+1); | |
s+=ch; | |
if(s<res) res=s; | |
} | |
return res; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment