Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf01ac5b

Browse files
authored
Fixed Spacing
1 parentd435414 commitf01ac5b

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
stringminRemoveToMakeValid(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-
}elseif(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+
}elseif(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)

[8]ページ先頭

©2009-2025 Movatter.jp