tidy
This commit is contained in:
parent
cf517aeac3
commit
edbe0571dc
1 changed files with 2 additions and 4 deletions
|
@ -3,7 +3,6 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn f(nums: Vec<i32>) -> i32 {
|
fn f(nums: Vec<i32>) -> i32 {
|
||||||
let mut pivot = -1;
|
|
||||||
let mut rights = Vec::with_capacity(nums.len());
|
let mut rights = Vec::with_capacity(nums.len());
|
||||||
let mut cur = 0;
|
let mut cur = 0;
|
||||||
for n in nums.iter().rev() {
|
for n in nums.iter().rev() {
|
||||||
|
@ -16,9 +15,8 @@ fn f(nums: Vec<i32>) -> i32 {
|
||||||
for (i, num) in nums.into_iter().enumerate() {
|
for (i, num) in nums.into_iter().enumerate() {
|
||||||
cur += num;
|
cur += num;
|
||||||
if cur == rights[i] {
|
if cur == rights[i] {
|
||||||
pivot = i as i32;
|
return i as i32;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pivot
|
-1
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue