Question is simple,
given 3 letters, O represents on time, L represents Late, A represents absent.
A student can not have more than 3 absences in total(2 can be back to back), or 2 late next to each other(can not be back to back).
Given a size N, how many valid combinations can we have?
I used dfs with prunning, but a more optimal solution exists as hinted the the interviewer.
For example, a string starts with
Can someone help with an answer?