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, 두 큐 합 같게 만들기, 숫자고르기, 북쪽나라의 도로 #203

Merged
merged 4 commits into from
Nov 21, 2023

Conversation

jhg3410
Copy link
Member

@jhg3410 jhg3410 commented Nov 20, 2023

📌 from issue #201 📌

📋문제 목록📋

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

@jhg3410 jhg3410 self-assigned this Nov 20, 2023
@jhg3410 jhg3410 added the 희직 label Nov 20, 2023
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.

고생하셨습니다!!

return count
}
count++
if (count > 600000) break
Copy link
Member

Choose a reason for hiding this comment

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

오,,, 이걸 계산하실 줄은...

}
}
deque.clear()
visited.fill(false)
Copy link
Member

Choose a reason for hiding this comment

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

오 fill 까먹고있었는데 감사해요..

}
}
println(answers.size)
for(number in answers.sorted()) {
Copy link
Member

Choose a reason for hiding this comment

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

오 고차함수말고 그냥 메서드 버전도 있군요


private fun bfs(posList: List<Pos>): Int {
val deque = ArrayDeque<Pos>()
deque.addAll(posList)
Copy link
Member

Choose a reason for hiding this comment

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

addAll 잘쓰시네요..!

return count
}
count++
if (count > 600000) break
Copy link
Contributor

Choose a reason for hiding this comment

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

최적화 멋졌습니다👍

Comment on lines +15 to +23
while (true) {
now = numbers[now]
if (now == i) {
answers.addAll(tmp)
break
}
if (now in tmp || now in answers) break
tmp.add(now)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

while(true)하고 안에서 break처리를 항상 깔끔하게 잘 하시는 것 같아요

}
}

val flattenBoard = board.flatten()
Copy link
Contributor

Choose a reason for hiding this comment

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

잊고있던 flatten..고차함수도 자주 다양하게 써야겠어요

}
}

val flattenBoard = board.flatten()
Copy link
Member

Choose a reason for hiding this comment

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

flatten 으로 하는거 좋네요!!!

@jhg3410 jhg3410 merged commit 4875741 into main Nov 21, 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