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

[전현수] - 연구소 2, 두 큐 합 같게 만들기, 숫자고르기, 북쪽나라의 도로 #202

Merged
merged 4 commits into from
Nov 20, 2023

Conversation

soopeach
Copy link
Member

📌 from issue #201 📌

📋문제 목록📋

연구소 2: ✅
두 큐 합 같게 만들기: ⛔️
숫자고르기: ⛔️
북쪽나라의 도로: ⛔️

📍추가로 해결한 문제📍

추천: 👍  
비추천: 👎  
문제에 대한 간단한 코멘트를 남겨주셔도 좋을 것 같아요!

📝메모

공유하고 싶은 정보, 새롭게 알게된 것, 문제를 풀면서 발생한 에로사항 등...자유롭게!


@soopeach soopeach self-assigned this Nov 20, 2023
Comment on lines +34 to +36
numberList.drop(1)
.forEachIndexed { unCompletedIndex, value ->
linkInfoList[value].add(unCompletedIndex + 1)
Copy link
Member

Choose a reason for hiding this comment

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

밑에 줄을 기준으로 dfs 를 도신 게 좋았어요!

Comment on lines +43 to +44
val first = bfs(1)
println(bfs(first.index).cost)
Copy link
Contributor

Choose a reason for hiding this comment

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

전 무지성으로 풀었는데 수피치님 덕분에 트리의 지름이라는 개념도 알고 갑니다


}

fun dfs(target: Int, current: Int, visited: BooleanArray) {
Copy link
Contributor

Choose a reason for hiding this comment

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

이게 dfs로 된다는게 신기하네용

Comment on lines +122 to +123
copied.maxOf { row ->
row.maxOf { it }
Copy link
Member

Choose a reason for hiding this comment

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

kotlin은 이런게 참 이뿌네요

Comment on lines +65 to +80
fun dfs(cnt: Int, startIndex: Int, depth: Int) {
if (cnt == depth) {

simulate()
return
}

for (index in startIndex until virusPositions.size) {

selectedVirusIndexList.add(index)
dfs(cnt + 1, index + 1, depth)
selectedVirusIndexList.removeLast()

}

}
Copy link
Member

Choose a reason for hiding this comment

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

재귀 돌면서 구하는 것도 좋네용

@soopeach soopeach merged commit 3bd1d29 into main Nov 20, 2023
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