We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2792cf1 commit af98ff0Copy full SHA for af98ff0
solution/0000-0099/0058.Length of Last Word/README_EN.md
@@ -68,6 +68,25 @@ class Solution {
68
}
69
```
70
71
+### **Rust**
72
+
73
+```rust
74
+impl Solution {
75
+ pub fn length_of_last_word(s: String) -> i32 {
76
+ let s = s.trim_end();
77
+ if s.len() == 0 {
78
+ return 0;
79
+ }
80
+ for (i, c) in s.char_indices().rev() {
81
+ if c == ' ' {
82
+ return (s.len() - i - 1) as i32;
83
84
85
+ s.len() as i32
86
87
+}
88
+```
89
90
### **...**
91
92
0 commit comments