Number Pattern Problem Statement

Design a seating arrangement for a high-security meeting. There are 'N' rows of tables set up where the first row contains one table, the second row contains two tables, and so forth. To maximize security, tables on either end of each row are assigned to security personnel. If a row has only one table, it is assigned to security personnel. Tables for security personnel host exactly one person, while all other tables host two guests each. Your task is to display this seating arrangement showing the number of people at each table for a given number of rows 'N'.

Input:

The first line contains an integer 'T', the number of test cases.
Each test case contains a single integer 'N', representing the number of rows.

Output:

For each test case, print 'N' strings showing the table pattern.

Example:

For instance, with 4 rows, the output pattern is:
1
11
121
1221

Constraints:

  • 1 ≤ T ≤ 10
  • 1 ≤ N ≤ 103
  • Where 'N' is the number of lines.
  • Time Limit: 1 sec

Note:

You do not need to handle output printing, it is already managed. Simply implement the function logic.
Be the first one to answer
Add answer anonymously...
S&P Global Software Developer 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