Pattern 6

Beginner Problems Patterns Easy
  • This problem, while simple, forms the basic building block for algorithms related to pattern recognition and generation
  • In real-world software development, these kind of pattern algorithms underlie many different aspects, from simple user interface design (creating repetitive patterns or layouts) to more complex concepts like creating game stages procedurally in video game development
  • This exercise of generating patterns based on a given number can also serve as the elementary introduction to recursive functions and loops, vital concepts in any kind of programming

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:


12345

1234

123

12

1


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