← All questions
Coding
Zigzag Conversion
Asked at
PayPal
1Give yourself 5 minutes
2Answer out loud, not in your head
3Then compare with the answer below
0
Stuck? Show a way to structure it+
- 01Return early when one row or rows exceed length.
- 02Keep one builder per row and current direction.
- 03Append each character then reverse direction at boundaries.
- 04Concatenate row builders.
Reference answer
Then expect these follow-ups
What is the cycle length for a direct-index solution?
Tests: patterns
Why are builders preferable to repeated string concatenation?
Tests: performance
Free to read · better with Enzo
Practice this out loud with Enzo
Enzo runs it as a mock interview, pushes back with follow-ups, and grades you on the rubric.
Next question