Skip to content
← Back to the archive

29 August 2026

Open Seats

Medium Lists

Find the longest uninterrupted row of open seats.

You are given a list of seats where each seat is either 'open' or 'taken'. Read from left to right and count each uninterrupted run of open seats. Return the length of the longest run. Return 0 when there are no open seats.

Constraints

  • seats contains only 'open' and 'taken'
  • An empty list returns 0

Function signature

def longest_open_row(seats):

Sign in to solve this bracket

Reading the problem is free for everyone. Opening the editor and solving it requires an account with Open Bracket+.