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
Be the first one to answer
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