Practice Decode the Slanted Ciphertext
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
The original text is written into a matrix with rows rows by following diagonals downward and rightward, starting successively at each column of the top row. Unfilled cells contain spaces, and the rightmost column contains an original-text character. Reading the matrix row by row produces encodedText. Recover and return the unique original text; it has no trailing spaces. Preserve spaces within the original text.
Source: Decode the Slanted Ciphertext on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
encodedText = "ch ie pr", rows = 3
"cipher"
# Example 2
encodedText = "iveo eed l te olc", rows = 4
"i love leetcode"
# Example 3
encodedText = "coding", rows = 1
"coding"
Constraints
Related LeetCode Problems
Practice more problems similar to Decode the Slanted Ciphertext.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.