**Problem Statement**

In a university, your attendance determines whether you’ll be allowed to attend your graduation ceremony. You are not allowed to miss classes for **four or more consecutive days**. You graduation ceremony is on the last day of the of the academic year, which is the Nth day.

Your task is to determine the following:

- The number of ways of attending classes over N days.
- The probability that you will miss your graduation ceremony.

**Information I tried to decode from the problem statement:**

- There would be two choices everyday for N number of days i.e. attend the class or not.
- But, because of the constraint, the allowed
**consecutive**gaps are 0 days, 1 days, 2 days and 3 days. - Let’s try to find the invalid ways and subtract it from total number of possibilities.
- So, Total number of ways – Invalid possibilities i.e. 4. $$ 2^{n – 1} – ( 2^{n – 4} * (n – 3)) $$

**MY DOUBT**

Actually, I am not able to figure out whether my solution is correct. My approach seems right to me but actually it is right or wrong I’m not able to figure out. Or is there any other way of solving this problem?

Any assistance will be helpful. Sorry If I missed something. Please do let me know what else I can add.

Thanks