C# O(N) Solution
Example:\n\n// \'_\' - space\n// encodedText = "c h _ _ _ i e _ _ _ p r",  encodedLength = 12, rows = 3, \n// columns = encodedText.Length/rows = 4\n// encodedT
**Example:**\n```\n// \'_\' - space\n// encodedText = "c h _ _ _ i e _ _ _ p r",  encodedLength = 12, rows = 3, \n// columns = encodedText.Length/rows = 4\n// encodedText[0] = c\n// encodedText[5] = i\n// encodedText[10] = p\n// encodedText[1] = h\n// encodedText[6] = e\n// encodedText[11] = r\n// encodedText[2] = _  \n// encodedText[7] = _\n// encodedText[3] = _\nHere we can see pattern - 0, 5, 10, 1, 6, 11, ...\n```\n\n**Solution with array:**\n\n```\n\tpublic string DecodeCiphertext(string encodedText, int rows) {\n        if (rows == 1 || encodedText.Length == 0)\n            return encodedText;\n        \n        int columns = encodedText.Length / rows;\n        int offset = columns+1; \n        var decodedArr = new char[encodedText.Length];\n        var decodedIndex = 0;\n        var lastLetterIndex = 0;\n        for (int start=0; start<columns; start++) \n        {\n            for (int index = start; index < encodedText.Length; index += offset) \n            {\n                decodedArr[decodedIndex] = encodedText[index];\n                if (Char.IsLower(decodedArr[decodedIndex]))\n                    lastLetterIndex = decodedIndex;\n                decodedIndex++;\n            }\n        }\n        return new string(decodedArr, 0, lastLetterIndex+1); // remove all trailing spaces\n    }\n```\n\n**Solution with StringBuilder:**\n```\n\tpublic string DecodeCiphertext(string encodedText, int rows) {\n        if (rows == 1 || encodedText.Length == 0)\n            return encodedText;\n        \n        var sb = new StringBuilder(encodedText.Length);\n        int columns = encodedText.Length / rows;\n        int offset = columns+1;\n        for (int start=0; start<columns; start++) \n            for (int index = start; index < encodedText.Length; index += offset) \n                sb.Append(encodedText[index]);\n        \n        return sb.ToString().TrimEnd();\n    }\n```
[]