Pattern 21

Beginner Problems Patterns Medium
  • This simple programming problem highlights the use of loops and control flow which forms the basis of many graphics and game development concepts
  • For example, such pattern drawing exercises lay the groundwork for understanding nested loops which are very common in game grids or tile maps, bitmap graphics, and visual simulations
  • Moreover, this is the core concept behind rendering of shapes in computer graphics, interfaces, animation, and even 3D modeling software
  • It is also used in designing UI layout and border styles in web development

Given an integer n. You need to recreate the pattern given below for any value of N. Let's say for N = 5, the pattern should look like as below:


*****
*   *
*   *
*   *
*****


Print the pattern in the function given to you.

Constraints

  • 1 <= n <= 20

Company Tags

TCS Cognizant Accenture Infosys Capgemini Wipro IBM HCL Tech Mahindra MindTree