Walmart Global Tech interview question

Space and time complexity for an easy algorithm question