Pattern 12

Beginner Problems Patterns Easy
  • Though this problem seems purely academic, the underlying concepts - the manipulation of strings and control structures like loops, are fundamental in many areas of software development
  • For instance, generating dynamic SQL queries for specific situations often requires sophisticated string manipulation
  • Also, the understanding and usage of nested loops are crucial in rendering hierarchical data or multi-dimensional arrays, like creating expandable menu systems in app development
  • So while this exact problem may not be seen in the wild, its elemental concepts are heavily utilized in coding

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:


1        1
12      21
123    321
1234  4321
1234554321


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