FunctionRacerProblemsRace

Three in a Row

MediumpandasPython

logs has a column num of ints, in order. Return a sorted list of every number that appears at least three times in a row (in three or more neighbouring rows), each listed once.

Example 1

logs {"num":[1,1,1,2,1,2,2]}
returns [1]

Only 1 appears three times in a row.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More pandas problems