Practice Maximum Students Taking Exam
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Maximum Students Taking Exam
Problem Statement
Given a m * n matrix seats that represent seats distributions in a classroom. If a seat is broken, it is denoted by '#' character otherwise it is denoted by a '.' character. Students can see the answers of those sitting next to the left, right, upper left and upper right, but he cannot see the answers of the student sitting directly in front or behind him. Return the maximum number of students that can take the exam together without any cheating being possible. Students must be placed in seats in good condition.
Source: Maximum Students Taking Exam on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
seats = [["#",".","#","#",".","#"], [".","#","#","#","#","."], ["#",".","#","#",".","#"]]
4
# Example 2
seats = [[".","#"], ["#","#"], ["#","."], ["#","#"], [".","#"]]
3
# Example 3
seats = [["#",".",".",".","#"], [".","#",".","#","."], [".",".","#",".","."], [".","#",".","#","."], ["#",".",".",".","#"]]
10
Constraints
Related LeetCode Problems
Practice more problems similar to Maximum Students Taking Exam.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.