⏱ 00:00
Attempts:0
Best: 0/100
Harmonics & Trigonometric DiscretizationTarget Time: 20 mins
Wave Pattern
Given wave height H and number of wave cycles W, print a discrete triangular wave using asterisks (*). Each cycle spans 2 * (H - 1) columns, so the full width is W * 2 * (H - 1) + 1 columns. The wave starts at the bottom row in column 0 and rises to the top row at the middle of each cycle.
Input Format
Two space-separated integers H and W.
Output Format
Print H rows of wave pattern.
Constraints:2 <= H <= 6, 1 <= W <= 4
Concepts Required:
Periodic coordinate mappingTriangular wave projection |x - H|
Expected Pattern PreviewASCII Monospace
H=3, W=2: * * * * * * * * *
Notice how character spacing and row counts scale systematically based on the input N.
Concrete Examples
Example 1
Input:
3 2
Output:
* * * * * * * * *
Explanation: Height 3 gives a period of 4 columns; 2 cycles span 2 * 4 + 1 = 9 columns.
