https://www.codechef.com/problems/NAME2

Hi Everyone,

I am getting a wrong answer this problem. What is wrong in my solution.

https://www.codechef.com/viewsolution/60101139

Hey akshaypatade_1 :smiling_face: ,
You are getting NZEC because in line number 67 you are storing (25000)*(25000) of data which is not possible as It will cause memory overflow , also your code has Time complexity of O(n^2) which is also the next error which will give TLE.

I suggest you to solve this problem in O(n+m) time using two pointer approach :slight_smile: