Skip to content

Commit 9576139

Browse files
authored
Create cells-in-a-range-on-an-excel-sheet.cpp
1 parent 2093bf9 commit 9576139

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Time: O(26^2)
2+
// Space: O(1)
3+
4+
// enumeration
5+
class Solution {
6+
public:
7+
vector<string> cellsInRange(string s) {
8+
vector<string> result;
9+
for (char x = s[0]; x <= s[3]; ++x) {
10+
for (char y = s[1]; y <= s[4]; ++y) {
11+
result.push_back({x, y});
12+
}
13+
}
14+
return result;
15+
}
16+
};

0 commit comments

Comments
 (0)