fucking-algorithm
fucking-algorithm copied to clipboard
[fix][golang] merge-k-sorted-lists
- Define the
pqvariable as a pointer to simplify the syntax and make it easier for the reader to understand. - Replace
interface{}withany, although they are equivalent, usinganykeeps the code consistent with the go's toolgenerate interface stubs. - Simplify the pop node expression for better understanding.
- Rename Queue to PriorityQueue to avoid conceptual confusion. Queue is commonly used to represent a first-in-first-out (FIFO) queue, while PriorityQueue is commonly used to represent a heap.
我修改的是如下题目的 golang 解法: https://leetcode.com/problems/merge-k-sorted-lists
通过截图如下: