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

[Week6] 전현수: 거리두기 확인, 동전 0, 수리공 항승, 큰 수 만들기, 신입 사원, 잃어버린 괄호 #27

Merged
merged 7 commits into from
Jun 25, 2022

Conversation

soopeach
Copy link
Member

@soopeach soopeach commented Jun 24, 2022

📒 Issue Number

linked issue #26


💎 문제 해결

거리두기 확인: ⭕️
동전 0: ⭕️
수리공 항승: ⭕️
큰 수 만들기: 🔺 
신입 사원: 🔺 
잃어버린 괄호: 🔺 

🔥 특이사항/질문

자유롭게 작성해주세요!

신입 사원, 잃어버린 괄호 문제는 구현이 어려운 문제는 아니었는데, 문제를 이상하게 이해해서 시간 낭비를 엄청했네요..
큰 수 만들기는 조합으로 푸는 로직밖에 생각을 못해서 구글링을 통하여 해결하였습니다.

@soopeach soopeach changed the title [Week6] 전현수: 동전 0, 수리공 항승, 큰 수 만들기, 신입 사원, 잃어버린 괄호 [Week6] 전현수: 거리두기 확인, 동전 0, 수리공 항승, 큰 수 만들기, 신입 사원, 잃어버린 괄호 Jun 24, 2022
Copy link
Member

@gongdongho12 gongdongho12 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 +47 to +48
val dx = intArrayOf(-1,1,0,0)
val dy = intArrayOf(0,0,-1,1)
Copy link
Member

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 {
Copy link
Member

Choose a reason for hiding this comment

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

문제에 이미 소팅이 되어있는 거라 reverse만 해주셔도 됩니다

Comment on lines +22 to +28
if (index == 0) {
// 마지막으로 테이프를 붙인 위치는 테이프를 붙인 위치 - 0.5를 해줌.
lastLocation = location - 0.5f
// 필요한 테이프 1 증가.
needTape++
return@forEachIndexed
}
Copy link
Member

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}
Copy link
Member

Choose a reason for hiding this comment

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

sort도 괜찮은데 priorityQueue도 활용해보면 좋을거같아요

Comment on lines +40 to +43
if (indexForOperator <= minusLoation || minusLoation == -1){
num += dividedNum
} else {
num -= dividedNum
Copy link
Member

Choose a reason for hiding this comment

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

마지막에 합을 한걸로 뺴고 더하는데 반복문 내에 있으니까 sumOf 같은 연산으로 간단하게 작성이 가능했을거같아요

@soopeach soopeach merged commit bac8238 into main Jun 25, 2022
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