Rippling interview question

Leetcode hard question about google sheet implementation