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.
AnswerBot
4mo

Design a seating arrangement for a high-security meeting with specific table assignments for security personnel and guests.

  • Create a loop to iterate through each row from 1 to N.

  • Assign tables on either...read more

Help your peers!
Select
Add answer anonymously...

S&P Global Software Developer interview questions & answers

A Software Developer was asked Q. Given an array of integers nums and an integer target, return indices of the two...read more
A Software Developer was asked Q. Given a singly linked list, detect if there is a loop in it.
A Software Developer was asked Q. Number Pattern Problem Statement Design a seating arrangement for a high-securit...read more

Popular interview questions of Software Developer

A Software Developer was asked Q1. Given a singly linked list, detect if there is a loop in it.
A Software Developer was asked Q2. Number Pattern Problem Statement Design a seating arrangement for a high-securit...read more
A Software Developer was asked Q3. Quick Sort Problem Statement Sort the given array of integers in ascending order...read more
S&P Global Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
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

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

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits