Problem
This problem was asked by PayPal.
Given a string and a number of lines, print the string in a zigzag form. In zigzag, characters are printed out diagonally from top left to bottom right until reaching the kth
line, then back up to top right, and so on.
For example, given the sentence "thisisazigzag"
and k = 4
, you should print:
——————————————————————————————————————
Bonuses/Promotion (Get Free Stuff)
To get access to the solution for this problem (and high-quality breakdowns of many other problems), subscribe to the publication right here. Join various other coders nailing interviews at top-tier firms such as Facebook, Microsoft, Google, Fidelity, and more:
To share interesting problems/solutions with me, reach out to me. Different social media of mine also have other content from me. Good problems and/or solutions receive a free shoutout + 2 months of the paid newsletter:
Reach out to me on Instagram: https://www.instagram.com/iseethings404/
Message me on Twitter: https://twitter.com/Machine01776819
My LinkedIn: https://www.linkedin.com/in/devansh-devansh-516004168/