Coding problemINTERMEDIATEDifficulty: INTERMEDIATEIteration~10 min

Group consecutive values into runs

Given a list of daily status strings, return a list of (status, count) tuples describing consecutive runs.

python
["ok", "ok", "fail", "ok", "ok", "ok"]
# -> [("ok", 2), ("fail", 1), ("ok", 3)]

Starting point

sql
def runs(statuses: list[str]) -> list[tuple[str, int]]:
    ...