GEICO interview question

Similar to Robot Room Cleaner on leetcode