Question: Implement a function that takes a string and returns a new string that is a zig-zag rearrangement of it like the one in the examples

Implement a function that takes a string and returns a new string that is a zig-zag rearrangement of it like the one in the examples below.

• Parameters: text is a string (no validation needed)

• Examples:

zigzag('12345678') → '18273645'

zigzag('123456789') → '192837465'

zigzag('abcdefgh') → 'ahbgcfde'

zigzag('GeorgeMason') → 'GneoosragMe'

Step by Step Solution

3.48 Rating (164 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To implement the zigzag function that rearranges a given string in a zigzag fashion lets break down ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!