Code RoomFree seat columns
EasyPrep Room Coding #4787

Free seat columns

CodingAlgorithms & data structuresEntry–Mid~14 min

A campus lecture hall keeps its booking chart as a grid of single character seats. Row 0 is the back row, and chart[r][c] holds '.' for a free seat, 'X' for a booked seat, or 'B' for a seat taken out of service. Rows can differ in length, because the hall narrows toward the stage, so a column that exists in one row may simply not exist in a shorter row. The events team wants the columns it can sell as one whole vertical block. Return the indices of every column that is free in every row, in ascending order. A column counts only when each row actually has a seat at that index and that seat is '.', so a column missing from any row cannot be sold as a block. A chart with no rows returns an empty list.

Implement
clear_seat_columns(chart: list[list[str]]) → list[int]
Examples
in[[[".",".","X","."],[".",".","X","."],[".",".",".","."]]]out[0,1,3]
in[[["X",".","X"],[".",".","X"],[".","X","X"]]]out[]
in[[[".",".","."],[".","."],[".",".","."]]]out[0,1]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 14 min
InputExpectedGot
[[[".",".","X","."],[".",".","X","."],[".",".",".","."]]][0,1,3]not run yetsample
[[["X",".","X"],[".",".","X"],[".","X","X"]]][]not run yetsample
[[[".",".","."],[".","."],[".",".","."]]][0,1]not run yetsample