C++ Add Border
#include <string>
#include <vector>
std::vector<std::string> addBorder(std::vector<std::string> picture)
{
picture.insert(picture.begin(), std::string(picture[0].size(), '*'));
for (auto& row : picture) {
row = "*" + row + "*";
}
picture.push_back(std::string(picture[0].size(), '*'));
return picture;
}
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.