• 문제 링크
Rotate String - LeetCode
Can you solve this real interview question? Rotate String - Given two strings s and goal, return true if and only if s can become goal after some number of shifts on s. A shift on s consists of moving the leftmost character of s to the rightmost position.
leetcode.com
• 풀이 코드
public class Solution {
public boolean rotateString(String s, String goal) {
return s.length() == goal.length() && (s + s).contains(goal);
}
}'Problem Solving > LeetCode' 카테고리의 다른 글
| [LeetCode] 783. Minimum Distance Between BST Nodes - Java (0) | 2026.10.14 |
|---|---|
| [LeetCode] 771. Jewels and Stones - Java (0) | 2026.10.13 |
| [LeetCode] 766. Toeplitz Matrix - Java (0) | 2026.10.12 |
| [LeetCode] 762. Prime Number of Set Bits in Binary Representation - Java (0) | 2026.10.11 |
| [LeetCode] 748. Shortest Completing Word - Java (0) | 2026.10.10 |
댓글