Direct (Saudi Arabia) Interview Question

How to optimize query for efficient results