Amazon Interview Question

How to approach search function?