Number Pattern Generation

Ninja enjoys arranging numbers and wishes to organize them into N rows. The first row should have 1 number, the second row 2 numbers, the third row 3 numbers, and so forth, continuing sequentially.

Ninja begins filling numbers in ascending order from 1 onward. Upon reaching 9, the sequence restarts from 1.

Example:

Input:
N = 4
Output:
 1 
23
456
7891

Constraints:

  • 1 <= T <= 10
  • 1 <= N <= 500
  • Time Limit: 1 sec

Note:

You do not need to print the output; the task is to implement the function to produce the desired pattern.

AnswerBot
1mo

Generate number pattern in N rows with ascending order and restarting at 9.

  • Iterate through each row from 1 to N.

  • In each row, print numbers in ascending order starting from 1 and restarting at 9.

  • Handle...read more

Help your peers!
Add answer anonymously...
Kellton Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
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

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter