Cisco Interview Question

space complexity for a given task