Generation

generate functionSat, 12 Nov 2022

Add two arrays of numbers

pub fn add_arrays(a: &[i32], b: &[i32]) -> Vec<i32> { let mut result = Vec::new(); for i in 0..a.len() { result.push(a[i] + b[i]); } result } assert_eq!(add_arrays(&[1, 2], &[3, 4]), [4, 6]);

Want to kickstart your project?Use the new AI Studio to create your code