FastPrepBlock Type with the Most Children

Block Type with the Most Children

Notion logoNotion● MediumFULLTIMEPHONE SCREEN

Problem statement

Each block can be a root or a direct child of another block. Return the parent block type whose blocks collectively have the largest number of direct children.

Do not count root blocks as children. If several parent types tie, return the alphabetically smallest type. Return block_type and child_count.

Table schema

MySQLPostgreSQLPandas

Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.

blocks

ColumnTypeNullableDescription
block_idPKIntegerNo—
parent_block_idIntegerYes—
block_typeTextNo—

Foreign key: parent_block_id → blocks(block_id)

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
block_typeTextNo—
child_countIntegerNo—

Row order: must match exactly. Numeric tolerance: 0.

Constraints

  • parent_block_id is null only for root blocks.
  • At least one child block is present.
  • Count only direct parent-child relationships.

More Notion problems

See Notion hiring insights