Delhivery Interview Question

Two Sum Problem ( The optimised solution which can work with duplicate numbers too)