Alternating Pattern with Segment Reversals

Company: Amazon HackOn

Difficulty: medium