随笔分类 -  c++

摘要:347. 前 K 个高频元素 难度中等1272收藏分享切换为英文接收动态反馈 给你一个整数数组 nums 和一个整数 k ,请你返回其中出现频率前 k 高的元素。你可以按 任意顺序 返回答案。 示例 1: 输入: nums = [1,1,1,2,2,3], k = 2 输出: [1,2] 示例 2: 阅读全文
posted @ 2022-07-27 22:31 乐乐章 阅读(108) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2019-07-15 22:07 乐乐章 阅读(243) 评论(0) 推荐(0)
摘要:简介 1 位逻辑运算符: & (位 “与”) and 2个都为1 才是1 0^0 = 0 , 0^1 = 0, 1^0 = 0 1^1= 1 ^ (位 “异或”) 相同为0,不同为1 0^0 = 0 , 1^1 = 0, 1^0 = 1 1^0 = 1 | (位 “或”) or 有一个是1 就是1 阅读全文
posted @ 2019-01-16 15:25 乐乐章 阅读(1318) 评论(0) 推荐(0)
摘要:#include #include std::vector s_split(const std::string& in, const std::string& delim) { std::regex re{ delim }; // 调用 std::vector::vector (InputIterator first, InputIterator last,const all... 阅读全文
posted @ 2019-01-03 20:04 乐乐章 阅读(3745) 评论(0) 推荐(0)
摘要:用法 1、sort函数可以三个参数也可以两个参数,必须的头文件#include < algorithm>和using namespace std; 2、它使用的排序方法是类似于快排的方法,时间复杂度为n*log2(n) 3、Sort函数有三个参数:(第三个参数可不写) (1)第一个是要排序的数组的起 阅读全文
posted @ 2018-12-25 12:54 乐乐章 阅读(890) 评论(0) 推荐(0)
摘要:set c++ 如何检查一个元素是否在std :: set? 有一个更简单的等价的下面的代码: myset.find(x) != myset.end() 有一个更简单的等价的下面的代码: 检查许多STL容器中的存在的典型方法是: const bool is_in = container.find(e 阅读全文
posted @ 2018-12-24 14:41 乐乐章 阅读(1227) 评论(0) 推荐(0)
摘要:1、int 2 string 法1:c++11里面的to_string 法2: 2 string 2 int https://www.cnblogs.com/gaobw/p/7070622.html 阅读全文
posted @ 2018-12-23 15:08 乐乐章 阅读(173) 评论(0) 推荐(0)