beats 90% easy solution c++
Intuition\n Describe your first thoughts on how to solve this problem. \nfor encoded text length times traverse diagonally and add it to the result. remove all 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nfor encoded text length times traverse diagonally and add it to the result. remove all the trail spaces and return. \n\n# Approach\n<!-- Describe your approach to solving the problem. -->\ntraverse no of columns times and add characters diagonally (2d array as 1d array method) until it crosses limits. and remove trailing spaces. \n\n# Complexity\n- Time complexity:O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\nPlease upvote if you find it helpful \n\n# Code\n```\nclass Solution {\npublic:\n    string decodeCiphertext(string encodedText, int rows) {\n        if(encodedText == "")  return encodedText; \n        int columns = ceil(encodedText.length()/rows);\n        string ans = ""; \n        for(int i=0; i<columns; i++){\n            int r = 0, c = i; \n            while(c < columns && r<rows){ ans += encodedText[r*columns + c]; r++; c++;}\n        }\n        int len = ans.length(); \n        while(ans[len-1] == \' \') len--;\n        ans = ans.substr(0, len); \n\n        return ans; \n    }\n};\n```
['C++']