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

20210608-13.Roman to integer solution #40

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

Conversation

ChobobDev
Copy link
Member

독설을 기다립니당

Comment on lines +59 to +76
func romanToInt(s string) int {
if len(s) == 0 {
return 0
}
currentnum, prevint, total := 0, 0, 0
for i := 0; i < len(s); i++ {
char := s[len(s)-(i+1) : len(s)-i]
currentnum = roman[char]
if currentnum < prevint {
total = total - currentnum
} else {
total = total + currentnum
}
prevint = currentnum
}
return total

}
Copy link
Member

@ForestLee0513 ForestLee0513 Jun 10, 2021

Choose a reason for hiding this comment

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

들여쓰기랑 줄넘김이 개선되면 좋을 것 같아요 👀

Copy link
Contributor

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.

3 participants