iRobot Interview Question

Time complexity and space complexity