摘要: 1.剑指 Offer 39. 数组中出现次数超过一半的数字 1)排序后位于中间的数就是我们要求的数 1 class Solution { 2 public: 3 int majorityElement(vector<int>& nums) { 4 sort(nums.begin(),nums.end 阅读全文
posted @ 2022-07-19 12:37 balabalahhh 阅读(23) 评论(0) 推荐(0)
摘要: https://blog.csdn.net/Sungree/article/details/100834974 注意:因为是数组表示(有值的区域里没有空缺),所以这个二叉树是完全二叉树 大顶堆: C语言代码 1 #include <stdio.h> 2 #include <stdlib.h> 3 # 阅读全文
posted @ 2022-07-19 11:14 balabalahhh 阅读(31) 评论(0) 推荐(0)