Notice
Recent Posts
Recent Comments
Link
목록Queue (1)
민스씨의 일취일장

백준 1524를 해결하기 위해 작성한 코드를 리팩토링하는 글입니다.코드 클리닉 - 백준 1524 코드 리뷰 작성한 코드처음에 작성한 로직이다. Queue를 사용할 때 poll()만 사용한 한계가 엿보인다. 로직이 다소 복잡해, 어떤 걸 표현하고 싶은지 직관적으로 이해가 잘 안간다.private static String play(PriorityQueue A, PriorityQueue B){ int a = A.poll(); int b = B.poll(); while(!A.isEmpty() && !B.isEmpty()){ if (a >= b) { b = B.poll(); } else { a = A.poll(); } ..
Code Clinic
2024. 11. 18. 10:40