leetcode2sumc-LeetCode_Solutions:剑指offer、Leetcode题解c++版本

时间:2021-07-06 17:52:11
【文件属性】:
文件名称:leetcode2sumc-LeetCode_Solutions:剑指offer、Leetcode题解c++版本
文件大小:657KB
文件格式:ZIP
更新时间:2021-07-06 17:52:11
系统开源 leetcode 2 sum c LeetCode Solutions 基础 输入 数据个数未知 1 3 5 10 // C++ vector v; int tmp; while(cin >> tmp){ v.push_back(tmp); if (getchar() == '\n') break; } 生成数据(结构) // 二维数组 int dp[n][m]; // 方法1 memset(dp,0,sizeof(dp)); // 用0填充 vector> dp(n,vector(m,0)); // 方法2;n*m填充0 vector res(input.begin(), input.begin() + k); // 方法3;input是已经存在的vector // 优先队列 最大最小堆 priority_queue> pq; // 最大堆,默认 priority_queue, vector>, greater>>

网友评论