偷一下懒...
越简单的题目越容易出错啊!(没想到n>str.length()的情况)
public class Solution { public String LeftRotateString(String str, int n) { if (str == null || n > str.length()) { return str; } return str.substring(n) + str.substring(0, n); } }
偷一下懒...
越简单的题目越容易出错啊!(没想到n>str.length()的情况)
public class Solution { public String LeftRotateString(String str, int n) { if (str == null || n > str.length()) { return str; } return str.substring(n) + str.substring(0, n); } }