⏱ 00:00
Attempts:0
Best: 0/100
Wave & Modular ArithmeticTarget Time: 15 mins
Zig-Zag Pattern
Given an integer N, print a 3-row zig-zag wave of length N where stars appear at wave peaks and troughs according to modular indexing: (row + col) % 4 == 0 or (row == 2 && col % 4 == 0).
Input Format
A single integer N denoting the number of columns (N >= 5).
Output Format
Print 3 rows forming the zig-zag wave.
Constraints:5 <= N <= 30
Concepts Required:
Modular periodic wave function3-row coordinate mapping
Expected Pattern PreviewASCII Monospace
* * * * * * * * *
Notice how character spacing and row counts scale systematically based on the input N.
Concrete Examples
Example 1
Input:
9
Output:
* * * * * * * * *
Explanation: A 3-row zig-zag wave oscillating with period 4.
