
-Code
public class LeetCode796 {
// Rotate String
public boolean rotateString(String s, String goal) {
// 2배로 늘리면 회전된 모든 글자를 확인 가능
String repeatStr = s.repeat(2);
// 포함되는지 확인
return repeatStr.contains(goal);
}
}'알고리즘 문제 > Java' 카테고리의 다른 글
| [LeetCode/Java] Most Common Word (0) | 2026.07.03 |
|---|---|
| [LeetCode/Java] Defanging an IP Address (0) | 2026.07.02 |
| [LeetCode/Java] Reverse Words in a String III (0) | 2026.06.30 |
| [LeetCode/Java] Fibonacci Number (0) | 2026.06.29 |
| [LeetCode/Java] Sum of Left Leaves (0) | 2026.06.28 |