Vertical Cipher
Given a string s
and an integer k
, rearrange s
into k
rows so that s
can be read vertically (top-down, left to right).
Constraints
n ≤ 10,000
wheren
is the length ofs
k ≤ 1,000
https://binarysearch.com/problems/Vertical-Cipher
Examples
Example 1
Input
- s =
abcdefghi
- k =
5
Output
- answer =
['af', 'bg', 'ch', 'di', 'e']
Explanation
This reads vertically as:
["af",
"bg",
"ch",
"di",
"e"]
Leave a comment