You are viewing a single comment's thread. Return to all comments →
Rust
fn diagonalDifference(arr: &[Vec<i32>]) -> i32 { let n = arr.len(); let mut left2right = 0; let mut right2left = 0; for i in 0..n { left2right += *arr[i as usize].get(i as usize).unwrap(); right2left += *arr[i as usize].get(n - 1 - i as usize).unwrap(); } (left2right - right2left).abs() }
Seems like cookies are disabled on this browser, please enable them to open this website
Diagonal Difference
You are viewing a single comment's thread. Return to all comments →
Rust