Max Students Taking Exam

Given a classroom grid with broken seats, place students in good seats such that no student can cheat from left, right, upper-left, or upper-right neighbors. Maximize the number of students.

Examples
Input: [["#",".","#","#",".","#"],[".","#","#","#","#","."],[".","#",".","#",".","#"]]
Output: 5
Hints

Max Students Taking Exam

Given a classroom grid with broken seats, place students in good seats such that no student can cheat from left, right, upper-left, or upper-right neighbors. Maximize the number of students.