思路
- substring直接截取字符串拼接
- 申请一个字符串数组
代码
public class Solution { public String LeftRotateString(String str,int n) { if(n>str.length()){return "";} String s1=str.substring(0,n); String s2=str.substring(n); return s2+s1; } }
public class Solution { public String LeftRotateString(String str,int n) { if(n>str.length()){return "";} String s1=str.substring(0,n); String s2=str.substring(n); return s2+s1; } }