-
Notifications
You must be signed in to change notification settings - Fork 0
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
[소병희] - 사과나무, 후위 표기식 #275
[소병희] - 사과나무, 후위 표기식 #275
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!
val pri = HashMap<Char, Int>() | ||
pri.put('+', 1) | ||
pri.put('-', 1) | ||
pri.put('*', 2) | ||
pri.put('/', 2) | ||
pri.put('(', 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
우선순위를 직접 맵으로 만들어서 관리하신게 좋아보이네요!!
} | ||
} | ||
|
||
if (sum % 3 > 0 || oneCnt > twoCnt) println("NO") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
한번에 체크한게 깔끔하네요!
while(st.isNotEmpty() && pri[st.last()]!! >= pri[i]!!) { | ||
sb.append(st.removeLast()) | ||
} | ||
st.add(i) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이렇게 우선순위 자체로 비교하는 부분이 문제가 원하는 해답인 것 같아서 좋네요!👍
📌 from issue #271 📌
📋문제 목록📋