Back
Close
  • 238

Learning Opportunities

This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.

Statement

 Goal

You have to rotate sizeXsize block counterclockwise by an angle angle. The block is filled with single ASCII characters. Angle is provided in degrees and is an odd multiple of 45. The output will always have a diamond shape.
Input
Line 1: Size of the block, size.
Line 2: Angle angle.
size following lines: Content of the block. ASCII characters are separated with spaces.
Output
Rotated block with spaces on both ends.
Constraints
2 =< size <= 100
45 =< angle <= 2295
angle % 90 == 45 (Dimond shape)
Example
Input
5
45
# # # # #
# - . . #
# # - . #
# # # - #
# # # # #
Output
    #    
   # #   
  # . #  
 # . . # 
# - - - #
 # # # # 
  # # #  
   # #   
    #    

A higher resolution is required to access the IDE