Getting Wrong anwer

I am using maps to reduce the time complexity but getting run-error for both test cases

share code using CB ide link.