# Game Of Life

Solution :

So this is a problem which can be easily solved in O(mn) space. But the challenge is to solve in O(1) time

The logic is since the matrix contains only 0 or 1. we can store the next state in the second bit

so if 0 changes to 1 then 10 is the state

so if 1 changes to 0 then 01 is the state

and vice versa . To get the current state we can do 01 & 1 to get the next state we can do left shift by 1