Rust Add Border
fn add_border(picture: &[String]) -> Vec<String> {
let width = picture[0].len();
let border = "*".repeat(width + 2);
let mut result = Vec::with_capacity(picture.len() + 2);
result.push(border.clone());
for row in picture {
result.push(format!("*{row}*"));
}
result.push(border);
result
}
This builds a new grid with a * border around every side. It adds a full top and bottom row, then wraps each existing row from left and right.