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
5d

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...
Popular interview questions of Software Developer Intern
>
REACH Technologies Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app