Easy to understand JavaScript solution
Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n# Code\n\nvar decodeCiphertext = function(encodedText, rows) {\n    const size = encodedTex
# Complexity\n- Time complexity:\n$$O(n)$$\n\n- Space complexity:\n$$O(1)$$\n\n# Code\n```\nvar decodeCiphertext = function(encodedText, rows) {\n    const size = encodedText.length;\n    const cols = size / rows;\n    let result = \'\';\n\n    for (let col = 0; col < cols; col++) {\n        let slant = 0;\n\n        for (let row = 0; row < rows; row++) {\n            const encodeIndex = row * cols + slant + col;\n            const text = encodedText[encodeIndex];\n\n            if (!text) return result.trimEnd();\n            result += text;\n            slant += 1;\n        }\n    }\n    return result.trimEnd();\n};\n```
['JavaScript']