答案五花八门
左旋转字符串
http://www.nowcoder.com/questionTerminal/12d959b108cb42b1ab72cef4d36af5ec
受以前某道题的启发,来了个这玩意:
str = abcXYZ
str+str = abc+XYZabc+XYZ
中间那段不就是我想要的吗
public class Solution { public String LeftRotateString(String str,int n) { if(str==null||str.length()==0 ) return ""; str = str+str; return str.substring(n,n+str.length()/2); } }