2026/8/28 5:49:56
Kimi LeetCode 8.字符串转换整数(atoi) Rust实现
以下是 LeetCode 8. 字符串转换整数 (atoi) 的 Rust 实现:rust
impl Solution {pub fn my_atoi(s: String) -> i32 {let bytes s.as_bytes();let n bytes.len();let mut i 0;// 1. 跳过前导空格while i < n && bytes[i] b {i 1;}if i n {retur…