class Solution {
public boolean rotateString(String A, String B) {
if(A.length()!=B.length()) return false;
if(A.length()==0) return true;
for(int i=0;i<A.length();i++){
String tmp = A.substring(i)+A.substring(0,i);
if(tmp.equals(B)) return true;
}
return false;
}
}
leetcode 796. Rotate String
最新推荐文章于 2024-11-05 21:58:11 发布