178. Max Students Taking Exam

Given a classroom layout: # is a broken seat, . is a working seat. Seat as many students as possible so that no one looks at a neighbor in the same row or diagonally.
Example 1
Input: seats = [["#",".","#","#",".","#"],[".","#","#","#","#","."],["#",".","#","#",".","#"]]
Output: 4
Explanation: Maximum of 4 students.
Example 2
Input: seats = [[".","#"],["#","#"],["#","."],["#","#"],[".","#"]]
Output: 3
Explanation: Maximum of 3 students.
arraysbit manipulationhard
JavaScript
Loading...
Line 1, Char 1