days working days is a string of length days where each character describes one day:
- 'P': on time;
- 'L': late;
- 'A': absent.
The attendance bonus is earned when both hold:
- there are fewer than two absences ('A') over the whole period;
- there are never three or more lates ('L') on consecutive days.
How many different timesheets of length days earn the bonus? The answer can be very large, so return it modulo 10⁹ + 7.days=2 → 8
There are 9 two-day timesheets, and only AA misses the bonus because it has two absences.
days=3 → 19
Out of 27 timesheets, LLL fails, and so do the seven with two or three absences.
days=50 → 100469819
The answer is taken modulo 10⁹ + 7.
days ≤ 10⁵days=2
8
Run checks the first 3 tests in your browser. Submit checks all 14 tests on the server, hidden ones included.