Just a runnable solution
\nimpl Solution {\n    pub fn find_maximum_length(nums: Vec<i32>) -> i32 {\n        let n = nums.len();\n        let mut pref: Vec<i64> = vec![0; n + 1];\n     
```\nimpl Solution {\n    pub fn find_maximum_length(nums: Vec<i32>) -> i32 {\n        let n = nums.len();\n        let mut pref: Vec<i64> = vec![0; n + 1];\n        for i in 0..n {\n            pref[i + 1] = pref[i] + nums[i] as i64;\n        }\n        let mut dp: Vec<(i32, i64)> = vec![(0, 0); n + 2];\n        dp[0].0 = 1;\n        for i in 1..=n {\n            dp[i] = std::cmp::max(dp[i], dp[i - 1]);\n            let idx = match pref.binary_search(&(2 * pref[i] - dp[i].1)) {\n                Ok(v) => v,\n                Err(e) => e,\n            };\n            dp[idx] = std::cmp::max(dp[idx], (dp[i].0 + 1, pref[i]));\n        }\n        dp[n].0\n    }\n}\n```
['Rust']