-
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
[Week6] 전현수: 거리두기 확인, 동전 0, 수리공 항승, 큰 수 만들기, 신입 사원, 잃어버린 괄호 #27
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 dx = intArrayOf(-1,1,0,0) | ||
val dy = intArrayOf(0,0,-1,1) |
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.
dxdy를 List<Pair<Int, Int>> 로 사용하면 좀더 가독성이 효율적일거 같아요
} | ||
|
||
// 내림차순 정렬 | ||
coinList.sortedByDescending { it }.forEach { |
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.
문제에 이미 소팅이 되어있는 거라 reverse만 해주셔도 됩니다
if (index == 0) { | ||
// 마지막으로 테이프를 붙인 위치는 테이프를 붙인 위치 - 0.5를 해줌. | ||
lastLocation = location - 0.5f | ||
// 필요한 테이프 1 증가. | ||
needTape++ | ||
return@forEachIndexed | ||
} |
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.
index 그냥 0은 반복문 전에 사용했으면 내부에 retrun을 주지 않아도 되서 괜찮았을거 같아요
} | ||
|
||
// 지원자의 서류심사 순위로 오름차순 정렬 | ||
gradeList.sortBy{it.first} |
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.
sort도 괜찮은데 priorityQueue도 활용해보면 좋을거같아요
if (indexForOperator <= minusLoation || minusLoation == -1){ | ||
num += dividedNum | ||
} else { | ||
num -= dividedNum |
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.
마지막에 합을 한걸로 뺴고 더하는데 반복문 내에 있으니까 sumOf 같은 연산으로 간단하게 작성이 가능했을거같아요
📒 Issue Number
linked issue #26
💎 문제 해결
🔥 특이사항/질문
자유롭게 작성해주세요!
신입 사원, 잃어버린 괄호 문제는 구현이 어려운 문제는 아니었는데, 문제를 이상하게 이해해서 시간 낭비를 엄청했네요..
큰 수 만들기는 조합으로 푸는 로직밖에 생각을 못해서 구글링을 통하여 해결하였습니다.