Number Pattern Program
Write a program that takes an integer N
as input and prints a specific pattern for N
lines.
Example:
Input:
N=3
Output:
[[1, 2, 3, 10, 11, 12], [4, 5, 8, 9], [6, 7]]
Explanation:
For N=3, the pattern is created as follows:
First row: 1 2 3 10 11 12
Second row: 4 5 8 9
Third row: 6 7
Each list within the 2D list represents a row in the pattern.
Constraints:
- 1 <= N <= 1000
- Time Limit: 1 second

AnswerBot
4mo
The program takes an integer N and prints a specific number pattern for N lines.
Create a 2D list to store the pattern rows
Use loops to generate the numbers in each row based on the pattern
Print the 2D...read more
Help your peers!
Add answer anonymously...
>
REACH Technologies Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

