Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[스택, 큐, 덱] 9월 15일 #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

[스택, 큐, 덱] 9월 15일 #3

wants to merge 1 commit into from

Conversation

aqswa
Copy link
Collaborator

@aqswa aqswa commented Sep 15, 2021

No description provided.

Copy link
Member

@HyunJiLim0406 HyunJiLim0406 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3
수고하셨습니다! 1935번에 중복코드가 약간 있긴 하지만 다른 문제들은 아주 효율적으로 잘 푸셨어요~~
지금 작성하신 코드들에 함수화를 할 수 있을 부분들이 좀 보여요! 어떠한 연산결과를 리턴한다면 다 함수로 뺀다고 생각하고 리팩토링해볼까요?
시간이 없으시면 1935번에서 중복코드만 수정하셔도 돼요!
수정 후 리뷰어로 저 호출해주세요~~

Comment on lines +50 to +51

int main(){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

와 이걸 직접구현하셨네요! 정말 잘하셨어요!!
근데 사실 삭제&삽입 연산은 front와 back에서 아주 약간 다르게 작동해요!
아무튼 정말 멋져요...!

Comment on lines +18 to +22
map<char, double> value;
for (int i = 0; i < n; i++) {
cin >> t;
value['A' + i] = t;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

map도 좋지만, 다른 방법도 있어요! 코드를 잘 살펴보시면 답이 나올 것 같아요~

Comment on lines +32 to +59
else if(c == '*'){
a = st.top();
st.pop();
b = st.top();
st.pop();
st.push(a*b);
}
else if(c == '+'){
a = st.top();
st.pop();
b = st.top();
st.pop();
st.push(a+b);
}
else if(c == '/'){
a = st.top();
st.pop();
b = st.top();
st.pop();
st.push(b/a);
}
else if(c == '-'){
a = st.top();
st.pop();
b = st.top();
st.pop();
st.push(b-a);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기 중복이 많네요! 사칙연산 함수를 만드는건 어떨까요?

Comment on lines +30 to +31
//벡터에 맵 입력
vector<pair<string, int>> answer(word.begin(), word.end());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +13 to +19
//스택에 인형 종류 입력
for(int i=n-1; i>=0; i--){
for(int j=0; j<n; j++){
if(board[i][j] != 0)
doll[j].push(board[i][j]);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍👍 아주 잘하셨어요!

Comment on lines +25 to +26
if(doll[move-1].empty())
continue;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

잘 끊으셨습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants