Memory corruption


*** Error in `./solution’: malloc(): memory corruption: 0x00000000014a50a0 ***

Can anyone please help me,passes all pretests.


Seems like I have got same issue:
*** Error in `./solution’: free(): invalid next size (fast): 0x0000000001ab51a0 ***

more specific error definition is necessary. i am not deleting or freeing any memory, and i don’t use ‘new’ keyword in my c++ program.


I had the same error. In my case , it occured because I was creating a vector array inside the function and it was getting pilled up in the memory after each tests.

So, Instead of creating an vector locally inside the function like:
vector v(size ,value) ;
I created one global vector outside the function with
vector v ;
Now to initialize it , I used resize function of vector .

v.resize(size,value );

Hope this helped!!