796. Rotate String Easy
1/**
2 * [796] Rotate String
3 *
4 * Given two strings s and goal, return true if and only if s can become goal after some number of shifts on s.
5 * A shift on s consists of moving the leftmost character of s to the rightmost position.
6 *
7 * For example, if s = "abcde", then it will be "bcdea" after one shift.
8 *
9 *
10 * Example 1:
11 * Input: s = "abcde", goal = "cdeab"
12 * Output: true
13 * Example 2:
14 * Input: s = "abcde", goal = "abced"
15 * Output: false
16 *
17 * Constraints:
18 *
19 * 1 <= s.length, goal.length <= 100
20 * s and goal consist of lowercase English letters.
21 *
22 */
23pub struct Solution {}
24
25// problem: https://leetcode.com/problems/rotate-string/
26// discuss: https://leetcode.com/problems/rotate-string/discuss/?currentPage=1&orderBy=most_votes&query=
27
28// submission codes start here
29
30impl Solution {
31 pub fn rotate_string(s: String, goal: String) -> bool {
32 false
33 }
34}
35
36// submission codes end
37
38#[cfg(test)]
39mod tests {
40 use super::*;
41
42 #[test]
43 fn test_796() {
44 }
45}
46
Back
© 2025 bowen.ge All Rights Reserved.