Print a Shifted Number Rhombus
Updated
Problem statement
Return n text rows forming a shifted number rhombus. Each row contains the integers 1 through n in increasing order, separated by one ASCII space. Row r, with r starting at zero, has exactly n-1-r leading spaces. There are no trailing spaces. Return the rows as a string array rather than printing them.
Function
numberRhombus(n: int) → String[]Examples
Example 1
n = 3return = [" 1 2 3"," 1 2 3","1 2 3"]Leading spaces decrease from two to zero.
Example 2
n = 1return = ["1"]A side-one rhombus is a single number.
Constraints
- For this exercise, assume 1 <= n <= 100.
More Intuit Online Assessment questions
- Employee Promotion OpportunitiesOA · Seen Oct 2026
- Next Pascal Row CoefficientOA · Seen Oct 2026
- Parse Router LogsOA · Seen Oct 2026
- Longest Repeated Letter Block with Adjacent SwapsOA · Seen Oct 2026
- Maximum Square-Free DivisorOA · Seen Oct 2026
- Two Tribes from Taller-Person CountsOA · Seen Oct 2026
- Shortest Path from an Encoded GraphOA · Seen Sep 2026
- Oldest and Youngest EmployeesOA · Seen Sep 2026
- Pressure-Isolation Shutdown OrderOA · Seen Sep 2026
- Submask Sum QueriesOA · Seen Sep 2026
Similar questions at other companies
- Blood Type Inheritance: Possible Parent GenotypesAbridge · OAAbridge interview questions
- Branch with the Most FilesCapital One · OACapital One interview questions
- REST API: Highest International StudentsRippling · OARippling interview questions
- Rearrange String by Alternating EndsHudson River Trading · OAHudson River Trading interview questions
- Filter Isolated Interior Signal BitsSEDEMAC · OA
- Scale Ingredient QuantitiesUpstart · OAUpstart interview questions
- Telephone Keypad String EncodingEpic · OAEpic interview questions
- Count Invalid Log GroupsIBM · OAIBM interview questions
- Count Case-Insensitive TripletsTikTok · OATikTok interview questions
- Simulate a Deterministic Finite AutomatonPoint72 · OAPoint72 interview questions