int pop() {
minStack->pop();
return mainStack->pop();
}
Following pop() function line is not enough to bring minStack in sync with main stack, as in minStack, element which is being removed from main stack needs to be searched and then removed, and its not at the top of the minStack necessarily, as its top holds min element in stack!
minStack->pop();
Course: https://www.educative.io/collection/5642554087309312/5646276079124480
Lesson: https://www.educative.io/collection/page/5642554087309312/5646276079124480/5643517367943168