Getting run time error for 1 test case

@aryan_007
Your code is fine. The problem lies in the memory requirements. In the worst case, the space allocated will be 10^8 or greater which is not possible to allocate. Please try using the approach which utilizes O(2*sum) space. You can find the implementation on GFG. I hope that helps.

If my answer is able to answer your query, please mark the query as resolved.

so what is the maximum size a vector can be made ??

@aryan_007
Maximum size is around 10^7
The solution is not wrong. You are being prompted to look for better solutions. That’s the idea behind it.

If my answer is able to solve your query, please mark the doubt as resolved.

okay sir , thankyou sir