FastPrepEvent Type with the Most Events

Event Type with the Most Events

Notion logoNotion● EasyFULLTIMEPHONE SCREEN

Problem statement

Given an event log, return the event type with the largest number of event rows.

If several types tie, return the alphabetically smallest type. Return exactly event_type and event_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.

events

ColumnTypeNullableDescription
event_idPKIntegerNo—
user_idIntegerNo—
event_typeTextNo—
event_timeTimestampNo—

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
event_typeTextNo—
event_countIntegerNo—

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

Constraints

  • At least one event is present.
  • Count every event row, including repeated events from the same user.

More Notion problems

See Notion hiring insights