Siemens Interview Question

hashing and time complexity based