1. Key data structure:178 struct PageInfo {179 // Next page on the free list.180 struct PageInfo *pp_link;187 uint16_t pp_ref;188 };// These variables are set by
数组中出现次数超过一半的数字思路一:计算每个数字出现的次数这是常规思路,遍历数组并记录当前数字出现的次数,可以采用hash表(js中用Map类型)来记录。/** * @param {number[]} nums * @return {number} */var majorityElement = function(nums) { let m = new Map(); for(let num of nums){ m.has(num) ? m.set(num, m.