Given the spiral of size S
and the step N
, output the "square" S*S
spiral having N
asterisks, built from the outer to inner radius clockwise.
Test cases (examples) below.
Input:
4 3
Output:
***
Input:
4 6
Output:
**** * *
Input:
4 11
Output:
**** * * * ****
Input:
6 18
Output:
****** * * * * * * ******
Input:
6 22
Output:
****** *** * * * * * * * ******
Input:
6 27
Output:
****** ****** * ** * ** * ** ******
Input:
1 1
Output:
*
It's not necessary to handle the cases when:
provided
N
asterisks can't "fit" in the spiral of givenS*S
dimensions.either
N
orS
is zero.
The challenge is code-golf, shortest bytes answer wins, any languages can be used.
Your output may have as many trailing (but not leading) spaces/newlines as you wish.
S
size (or at least diameter) rather than radius \$\endgroup\$