Skip to content

Commit f01ac5b

Browse files
authored
Fixed Spacing
1 parent d435414 commit f01ac5b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

cpp/1249-minimum-remove-to-make-valid parentheses.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,23 @@ class Solution {
3131
string minRemoveToMakeValid(string s) {
3232
stack<pair<char,int>> st;
3333

34-
for(int i=0;i<s.size();i++){
35-
if(s[i]=='('){
36-
st.push(make_pair(s[i],i));
37-
}else if(s[i]==')'){
38-
if(!st.empty() and st.top().first=='('){
34+
for (int i = 0; i < s.size(); i++) {
35+
if (s[i] == '(') {
36+
st.push(make_pair(s[i], i));
37+
} else if (s[i] == ')') {
38+
if (!st.empty() and st.top().first == '(') {
3939
st.pop();
40-
}else{
41-
st.push(make_pair(')',i));
40+
} else {
41+
st.push(make_pair(')', i));
4242
}
4343
}
4444
}
4545

46-
while(!st.empty()){
47-
s.erase(s.begin()+st.top().second);
46+
while (!st.empty()) {
47+
s.erase(s.begin() + st.top().second);
4848
st.pop();
4949
}
5050

5151
return s;
5252
}
53-
};
53+
};

0 commit comments

Comments
 (0)