自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(78)
  • 收藏
  • 关注

原创 利用Visual Studio将C++项目打包成DLL文件

静态链接库(Lib)与动态链接库(DLL)如果出于某种原因,不想将源代码暴露给别人,就需要使用到库。库有动态链接库和静态链接库。静态连接库就是把(lib)文件中用到的函数代码直接链接进目标程序,程序运行的时候不再需要其它的库文件。动态链接就是把调用的函数所在文件模块(DLL)和调用函数在文件中的位置等信息链接进目标程序,程序运行的时候再从DLL中寻找相应函数代码,因此需要相应DLL文件的支持。

2022-03-11 22:27:09 17592 4

原创 Leetcode 124. 二叉树中的最大路径和

空间复杂度:O(n)。最坏情况下,二叉树退化成一条链,递归需要 O(n) 的栈空间。时间复杂度:O(n),其中 n 为二叉树的节点个数。

2025-07-20 17:19:49 185

原创 Leetcode 10. 正则表达式匹配

正则表达式匹配

2023-01-13 16:57:16 267

原创 Leetcode 11. 盛最多水的容器

盛最多水的容器

2023-01-12 16:59:08 237

原创 Leetcode 面试题 08.12. 八皇后

N皇后

2022-11-05 22:41:14 162

原创 回溯-排序

回溯排序

2022-11-05 19:49:28 106

原创 回溯-组合

回溯组合

2022-11-05 19:44:10 123

原创 Leetcode 78. 子集 && 90. 子集 II

给你一个整数数组 nums ,数组中的元素 互不相同 。返回该数组所有可能的子集(幂集)。解集 不能 包含重复的子集。你可以按 任意顺序 返回解集。

2022-11-04 21:44:36 167

原创 Leetcode 113. 路径总和 II

路径总和 II

2022-10-31 10:58:18 113

原创 组合与全排列

组合和全排列

2022-10-28 23:49:42 133

原创 Leetcode 129. 求根节点到叶节点数字之和

求根节点到叶节点数字之和

2022-10-26 23:52:54 130

原创 Leetcode 1647. 字符频次唯一的最小删除次数

频次唯一的最小删除次数

2022-08-28 15:25:12 96

原创 Leetcode 215 数组中的第K个最大元素

第K大的数

2022-08-19 15:19:01 210

原创 Leetcode 912 排序数组

快排

2022-08-19 12:21:45 136

原创 BM51 数组中出现次数超过一半的数字

数组中出现次数超过一半的数字

2022-08-18 21:58:30 127

原创 BM83 字符串变形

字符串变形

2022-08-16 10:09:45 136

原创 BM96 主持人调度(二)

主持人调度(二)

2022-08-15 12:20:06 122

原创 Leetcode 92. 反转链表 II

92. 反转链表 II

2022-08-15 10:59:23 143

原创 pycharm 配置远程环境

11

2022-06-23 16:05:24 178

原创 Leetcode 518. 零钱兑换 II

零钱兑换

2022-06-09 22:36:12 122

原创 Leetcode 474. 一和零

一和零

2022-06-09 15:46:51 104

原创 Leetcode 1049. 最后一块石头的重量 II

最后一块石头的重量

2022-06-02 19:33:07 95

原创 Leetcode 416. 分割等和子集

分割等和子集

2022-06-02 15:44:30 98

原创 HJ20 密码验证合格程序

代码#include <iostream>#include <string>using namespace std;bool check_char(string str) { // 核对大小写、数字、符号 int cate1 = 0, cate2 = 0, cate3 = 0, cate4 = 0; for (int i = 0; i < str.size(); i++) { if ( str[i] >= 'A' &a.

2022-05-27 22:18:50 123

原创 HJ15 求int型正整数在内存中存储时1的个数

代码#include <iostream>using namespace std;int main() { int num; while (cin >> num) { int m = 0; while (num) { m += num % 2; num /= 2; } cout << m << endl; }.

2022-05-27 17:35:21 97

原创 HJ12 字符串反转

代码#include <iostream>#include <string>#include <algorithm>#include <stack>using namespace std;int main() { string s; while (getline(cin, s)) {// reverse(s.begin(), s.end());// cout << s <&l.

2022-05-27 14:58:34 125

原创 HJ10 字符个数统计

哈希#include <iostream>#include <unordered_map>using namespace std;int main() { string str; while (cin >> str) { unordered_map<char, int> hash; for (auto ch : str) { if (hash.count(ch) == 0).

2022-05-19 20:41:48 146

原创 HJ8 合并表记录

哈希#include <iostream>#include <map>#include <unordered_map>using namespace std;int main() { int n; while (cin >> n) { map<int, int> tmp_map; for (int i = 0; i < n; i++) { int a, b.

2022-05-19 20:18:08 131

原创 HJ6 质数因子

#include <iostream>#include <math.h>using namespace std;int main() { int num; while (cin >> num) { int max = sqrt(num); for (int i = 2; i <= max; i++) { while (num % i == 0) { c.

2022-05-19 20:16:25 124

原创 HJ6 质数因子

#include <iostream>#include <math.h>using namespace std;int main() { int num; while (cin >> num) { int max = sqrt(num); for (int i = 2; i <= max; i++) { while (num % i == 0) { c.

2022-05-19 16:39:01 104

原创 HJ5 进制转换

#include <iostream>#include <string>#include <math.h>using namespace std;int main() { string s; while (cin >> s) { int bit = 0; int ans = 0; for (int i = s.size() - 1; i > 1; i--) { .

2022-05-19 16:10:26 200

原创 HJ4 字符串分隔

#include <iostream>using namespace std;int main() { string s; while (getline(cin, s)) { while (s.size() > 8) { cout << s.substr(0, 8) << endl; s = s.substr(8); } // s.resize(8.

2022-05-19 15:57:12 89

原创 HJ2 计算某字符出现次数

哈希表#include <iostream>#include <string.h>#include <unordered_map>using namespace std;int main() { string s; while (getline(cin, s)) { char target; cin >> target; unordered_map<char, int> .

2022-05-19 11:02:17 146

原创 HJ1 字符串最后一个单词的长度

代码#include <iostream>#include <string.h>using namespace std;int main() { string s; while (getline(cin, s)) { int index = s.size() - 1; int length = 0; while (s[index] == ' ') index--;.

2022-05-19 10:15:57 151

原创 Leetcode 70. 爬楼梯

状态转移方程代码class Solution {public: int climbStairs(int n) { if (n <= 2) return n; vector<int> dp(n + 1); dp[0] = 0; dp[1] = 1; dp[2] = 2; int a = 1, b =2, sum = 0; for (int i = 3; i &lt.

2022-05-13 22:14:29 162

原创 Leetcode 367. 有效的完全平方数

时间复杂度:O(log(num))空间复杂度:O(1)。空间复杂度:O(1)。时间复杂度:O(1)

2022-04-22 23:20:46 168

原创 leetcode 69. x 的平方根

方法一 转换公式class Solution {public: int mySqrt(int x) { if (x == 0) return 0; int ans = exp( 0.5 * log(x)); if ((long long) (ans + 1) * (ans + 1) <= x) ans = ans + 1; return ans; }};时间复杂.

2022-04-22 23:04:05 175

原创 基本二分、寻找左/右边界二分查找

1. 基本二分查找class Solution {public: int search(vector<int>& nums, int target) { int n = nums.size() - 1; int left = 0; int right = n; while (left <= right) { int mid = left + (right - left) / 2;

2022-04-22 21:18:46 405

原创 剑指 Offer 58 - I. 翻转单词顺序

思路:反向遍历,舍弃首尾的空格。代码:class Solution {public: string reverseWords(string s) { string ans; int n = s.length(); for (int i = n -1; i >= 0; i--) { if (s[i] != ' ') { int right = i; w.

2022-04-08 22:41:41 186

原创 剑指 Offer 31. 栈的压入、弹出序列

方法:代码:class Solution {public: bool validateStackSequences(vector<int>& pushed, vector<int>& popped) { stack<int> stack_a; int i = 0; for (int num : pushed) { stack_a.push(num); .

2022-04-08 17:37:34 106

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除