SOCIAL
--------------------------------------------------------------------------
Patreon: [ Ссылка ]
Instagram: [ Ссылка ]
Youtube (Subscribe): [ Ссылка ]
Solution Explanation:
We need to check each cells neighbors to see if they're alive or not. We can do a 1 step BFS to check the cells neighbors that are inbounds and then take the number of neighbors and current state to see if it fits a case. If it fits one of the four cases we apply it and otherwise we leave the cell to what it was. To do this in place, we make each cell a tuple of (curr_state, live_neighbors) and then pass over the array one more time to apply our rules.
Time: O(n), Space: O(1)
OTHER VIDEOS YOU MIGHT LIKE:
--------------------------------------------------------------------------
GOOGLE INTERVIEW QUESTION - COURSE SCHEDULER II: [ Ссылка ]
HOW MR. BEAST UPDATES HIS THUMBNAILS IN REAL TIME WITH PYTHON & PILLOW: [ Ссылка ]&
MUSIC
------------------------------------------------------------------
young frontwood: [ Ссылка ]
#amazoninterview #leetcode #techinterview
![](https://i.ytimg.com/vi/xgcaxGbED6E/mqdefault.jpg)