Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit 34d54dc

Browse files
committed
1046 done
1 parent 7cdd902 commit 34d54dc

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

Algorithms/1046.last-stone-weight/last-stone-weight.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,17 @@ type PQ []int
2323

2424
func (pq PQ) Len() int { return len(pq) }
2525

26-
func (pq PQ) Less(i, j int) bool {
27-
return pq[i] > pq[j]
28-
}
26+
func (pq PQ) Less(i, j int) bool { return pq[i] > pq[j] }
2927

30-
func (pq PQ) Swap(i, j int) {
31-
pq[i], pq[j] = pq[j], pq[i]
32-
}
28+
func (pq PQ) Swap(i, j int) { pq[i], pq[j] = pq[j], pq[i] }
3329

34-
// Push 往 pq 中放 entry
30+
// Push 往 pq 中放 int
3531
func (pq *PQ) Push(x interface{}) {
3632
temp := x.(int)
3733
*pq = append(*pq, temp)
3834
}
3935

40-
// Pop 从 pq 中取出最优先的 entry
36+
// Pop 从 pq 中取出最优先的 int
4137
func (pq *PQ) Pop() interface{} {
4238
temp := (*pq)[len(*pq)-1]
4339
*pq = (*pq)[0 : len(*pq)-1]

0 commit comments

Comments
 (0)