golang内置的排序sort.Slice() 直接上例子 链接:力扣上实战题 代码 类似于java中的重写compare方法; func topKFrequent(nums []int, k int) []int { n2p := make(