leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

2075.cpp (452B)


0 class Solution {
1 public:
2 string decodeCiphertext(const string &encodedText, int rows) const {
3 const int col = size(encodedText) / rows;
4 string res;
6 for (int i = 0; i < col; i++) {
7 for (int j = i; j < size(encodedText); j += (col + 1)) {
8 res += encodedText[j];
9 }
10 }
12 while (!res.empty() && res.back() == ' ')
13 res.pop_back();
15 return res;
16 }
17 };