class Solution {
public:
int minAddToMakeValid(string S) {
stack <char> stk;
for (auto s:S)
{
if (s==')' && stk.top() == '(')
{
stk.pop();
}
else
{
stk.push(s);
}
}
int size = 0;
while (!stk.empty())
{
size++;
stk.pop();
}
return size;
}
};AddressSanitizer:DEADLYSIGNAL
==30==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x000000405f82 bp 0x7fff590f9b80 sp 0x7fff590f9180 T0)
==30==The signal is caused by a READ memory access.
==30==Hint: address points to the zero page.
#1 0x7fbddfe032e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
AddressSanitizer can not provide additional info.
==30==ABORTING
what is this error?
how do i correct it?