You are viewing a single comment's thread. Return to all comments →
fn marsExploration(s: &str) -> i32 { let temp: Vec<char> = s.chars().collect(); let mut valid = 0; for (idx, c) in temp.iter().enumerate() { if (idx % 3 == 0 || idx % 3 == 2) && *c == 'S' { valid += 1; } else if idx % 3 == 1 && *c == 'O' { valid += 1; } } s.len() as i32 - valid }
Seems like cookies are disabled on this browser, please enable them to open this website
Mars Exploration
You are viewing a single comment's thread. Return to all comments →