Back to Practice
#0216

Floyd's Triangle

MediumPython25 min20 XP

Problem

Return n rows of Floyd triangle as a list of integer rows, where numbers increase continuously from 1.

Why This Matters

Floyd's triangle tests state carried across rows: the next number must continue where the previous row ended.

Function Signature

def floyd_triangle(n):

Examples

Example 1
Inputn = 4
Output[[1], [2, 3], [4, 5, 6], [7, 8, 9, 10]]

The counter keeps increasing across rows instead of restarting at 1.

Constraints

  • Return the exact requested value.
  • Handle small edge cases cleanly.
  • Prefer readable Python over clever shortcuts.
CodePython
Visible browser tests run here when available.
Testcases1 visible / 3 hidden categories
Core example
Inputn = 4
Expected[[1], [2, 3], [4, 5, 6], [7, 8, 9, 10]]

The counter keeps increasing across rows instead of restarting at 1.

Hidden Test Categories
small inputlarger inputedge shape