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

[소병희] - 사과나무, 후위 표기식 #275

Merged
merged 1 commit into from
Jun 2, 2024
Merged

Conversation

bngsh
Copy link
Contributor

@bngsh bngsh commented Jun 2, 2024

📌 from issue #271 📌

📋문제 목록📋

사과나무: ✅
후위 표기식: ⛔️

@bngsh bngsh added the 병희 label Jun 2, 2024
Copy link
Member

@soopeach soopeach left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

Comment on lines +10 to +15
val pri = HashMap<Char, Int>()
pri.put('+', 1)
pri.put('-', 1)
pri.put('*', 2)
pri.put('/', 2)
pri.put('(', 0)
Copy link
Member

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")
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 +28 to +31
while(st.isNotEmpty() && pri[st.last()]!! >= pri[i]!!) {
sb.append(st.removeLast())
}
st.add(i)
Copy link
Member

Choose a reason for hiding this comment

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

이렇게 우선순위 자체로 비교하는 부분이 문제가 원하는 해답인 것 같아서 좋네요!👍

@bngsh bngsh merged commit ccd6bd3 into main Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants