How to compare empty strings in C++?
I am doing a leetcode problem, I have a vector of vector of strings i.e vector< vector<string> > group;
I want to perform some specific task when any of the strings in the group vector is empty i.e of value equal to ""
. But when I try to make the comparison with std::string::compare()
method, I get the following error.
Removing characters from vector in C++
I want to remove current character and previous character in vector if it matches with the specified character. The code works for alphabetic characters like a, b, c. But if i want to remove multiple characters like *, the code gives segmentation fault. Any suggestions?