Visa Inc. interview question

asked about time complexity and space complexity