rust-interview / rust-leetcode-solutions

Solve https://leetcode.com/problems in Rust.
MIT License
0 stars 0 forks source link

use bytes.iter().enumerate() to get index and elem #28

Open 0xmountaintop opened 5 years ago

0xmountaintop commented 5 years ago
let bytes = s.as_bytes();
for (i, &item) in bytes.iter().enumerate() {
    if item == b' ' {
0xmountaintop commented 5 years ago