Skip to content

Commit 442a599

Browse files
committed
feat: add solutions to lc problem: No.0796
No.0796.Rotate String
1 parent 6adfd15 commit 442a599

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

solution/0700-0799/0796.Rotate String/README.md

+18
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,24 @@ func rotateString(s string, goal string) bool {
9797
}
9898
```
9999

100+
### **TypeScript**
101+
102+
```ts
103+
function rotateString(s: string, goal: string): boolean {
104+
return s.length === goal.length && (goal + goal).includes(s);
105+
}
106+
```
107+
108+
### **Rust**
109+
110+
```rust
111+
impl Solution {
112+
pub fn rotate_string(s: String, goal: String) -> bool {
113+
s.len() == goal.len() && (s.clone() + &s).contains(&goal)
114+
}
115+
}
116+
```
117+
100118
### **...**
101119

102120
```

solution/0700-0799/0796.Rotate String/README_EN.md

+18
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,24 @@ func rotateString(s string, goal string) bool {
8080
}
8181
```
8282

83+
### **TypeScript**
84+
85+
```ts
86+
function rotateString(s: string, goal: string): boolean {
87+
return s.length === goal.length && (goal + goal).includes(s);
88+
}
89+
```
90+
91+
### **Rust**
92+
93+
```rust
94+
impl Solution {
95+
pub fn rotate_string(s: String, goal: String) -> bool {
96+
s.len() == goal.len() && (s.clone() + &s).contains(&goal)
97+
}
98+
}
99+
```
100+
83101
### **...**
84102

85103
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
impl Solution {
2+
pub fn rotate_string(s: String, goal: String) -> bool {
3+
s.len() == goal.len() && (s.clone() + &s).contains(&goal)
4+
}
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function rotateString(s: string, goal: string): boolean {
2+
return s.length === goal.length && (goal + goal).includes(s);
3+
}

0 commit comments

Comments
 (0)