Triangle of Numbers Pattern

Ninja is tasked with printing a triangle pattern based on a given number 'N' for any test case.

Example:

Input:
N = 4
Output:
   1
232
34545
4567654

Explanation:

The pattern comprises numbers aligned in a triangle, centered and incremented with each row.

Constraints:

  • 1 <= T <= 5
  • 1 <= N <= 100
  • The number of test cases 'T'.
  • The number of rows 'N'.
  • Time limit: 1 sec.
AnswerBot
4mo

Print a triangle pattern of numbers based on a given number 'N'.

  • Iterate through each row and print the numbers accordingly

  • Use spaces to center-align the numbers in each row

  • Increment the numbers in eac...read more

Help your peers!
Select
Add answer anonymously...

Info Edge Software Developer interview questions & answers

A Software Developer was asked 9mo agoQ. Given the root node of a binary search tree (BST) and a value to be inserted int...read more
A Software Developer was asked 9mo agoQ. Given an integer array nums, find the subarray with the largest sum, and return ...read more
A Software Developer was asked Q. Anagram Pairs Problem Statement Determine if two given strings are anagram pairs...read more

Popular interview questions of Software Developer

A Software Developer was asked 9mo agoQ1. Given the root node of a binary search tree (BST) and a value to be inserted int...read more
A Software Developer was asked 9mo agoQ2. Given an integer array nums, find the subarray with the largest sum, and return ...read more
A Software Developer was asked Q3. Anagram Pairs Problem Statement Determine if two given strings are anagram pairs...read more
Info Edge 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