2019-11-10 LeetCode in Rust LeetCode 485. Max Consecutive Ones Problem Statement impl Solution { pub fn find_max_consecutive_ones(nums: Vec<i32>) -> i32 { let (mut sum, mut ans) = (0, 0); for num in nums { if num == 1 { sum += 1; ans = std::cmp::max(ans, sum); } else { sum = 0; } } return ans; }} Newer LeetCode 298. Binary Tree Longest Consecutive Sequence Older LeetCode 487. Max Consecutive Ones II