Loading...

The Zigzag Encoder

A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.

Domain
Python
Difficulty
medium
Seniority
mid, senior

Problem

A custom encoding scheme writes characters in a zigzag pattern across a fixed number of rows, then reads them row by row. Write a function that takes a string and a number of rows, and returns the string after applying the zigzag encoding pattern.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.