class Solution {
public:
vector<string> cellsInRange(string s) {
char c1=s[0], r1=s[1], c2=s[3], r2=s[4];
vector<string> v;
for(int i=0;i+c1<=c2;i++)
{
for(int j=0;j+r1<=r2;j++)
{
string p;
p+=(c1+i);
p+=(r1+j);
v.push_back(p);
}
}
return v;
}
};
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter