Rectangular Numbers Problem Statement
Ninja has a number 'N'. Your task is to generate a pattern where the outer rectangle is filled with the number 'N', and as you move inward, the numbers decrease consecutively.
Example:
Input:
N = 4
Output:
4 4 4 4 4 4 4
4 3 3 3 3 3 4
4 3 2 2 2 3 4
4 3 2 1 2 3 4
4 3 2 2 2 3 4
4 3 3 3 3 3 4
4 4 4 4 4 4 4
Constraints:
1 <= T <= 5
1 <= N <= 100
- Time limit: 1 sec.
Note:
You do not need to input or print anything, and it has already been taken care of. Just implement the given function.

AnswerBot
4mo
Generate a pattern with outer rectangle filled with number 'N' and decreasing consecutively inward.
Start by filling the outermost rectangle with the number 'N'.
Decrease the numbers consecutively as yo...read more
Help your peers!
Add answer anonymously...
Athenahealth Technology Software Developer interview questions & answers
A Software Developer was asked Q. Convert Binary Tree to Mirror Tree Convert a given binary tree into its mirror t...read more
A Software Developer was asked Q. Remove Character from String Problem Statement Given a string str and a characte...read more
A Software Developer was asked Q. Heap Sort Problem Statement Given an array ARR consisting of N integers, your ta...read more
Popular interview questions of Software Developer
A Software Developer was asked Q1. Convert Binary Tree to Mirror Tree Convert a given binary tree into its mirror t...read more
A Software Developer was asked Q2. Remove Character from String Problem Statement Given a string str and a characte...read more
A Software Developer was asked Q3. Heap Sort Problem Statement Given an array ARR consisting of N integers, your ta...read more
>
Athenahealth Technology Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app


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
AmbitionBox Awards
Get AmbitionBox app

