Number Pattern Generator
To arrange a high-security meeting, tables are set up for delegates and security personnel. There are N
rows of tables. The first row has one table, the second row has two tables, and so on, incrementing by one for each subsequent row. To maximize security, the tables on each end of a row are reserved for security personnel. If a row only has one table, it is assigned solely to a security personnel. Tables designated for security personnel accommodate one person each, while the remaining tables host two guests each.
Your task is to generate and display the pattern of guest and security personnel distributions across the tables for a given number of rows.
Example:
Input:
N = 4
Output:
1 11 121 1221
Explanation:
For each row, print the pattern that reflects the number of guests or security personnel at each table.
Constraints:
1 ≤ T ≤ 10
: the number of test cases1 ≤ N ≤ 10^3
: the number of rows- Time Limit: 1 sec
Top DE Shaw Technology Developer interview questions & answers
Reviews
Interviews
Salaries
Users/Month