自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(153)
  • 资源 (1)
  • 收藏
  • 关注

原创 小论文-基于注意力机制的人群密度估计

小论文-基于注意力机制的人群密度估计12.10初稿

2019-12-10 19:53:54 411 1

原创 C++ 输入的一些问题

这是输入一行字符串,然后通过空格为分隔符,分割每个字符串 string line; getline(cin, line); string s; istringstream input(line); while (input >> s) cout << s << endl;这个是对于需要以逗号为输入分割符号的时候vector<int&g...

2019-09-12 16:30:42 255

原创 竞技世界凉经

竞技世界凉经1.static关键字的使用,以及什么时候分配内存2.快开始和慢开始阶段,以及为什么使用这个3.为什么是由发送方主动发送0窗口探测报文的4.资源的利用以及分配效率的问题,这部分需要写代码,后续补上...

2019-09-04 11:14:48 323

原创 LeetCode 28 实现 strStr()

实现 strStr()void prefix_n(int prefix[], string needle, int n){ prefix[0] = 0; int len = 0; for (int i = 1; i<n;) { if (needle[i] == needle[len]) { ++len; prefix[i] = len; ++i; ...

2019-09-02 22:57:23 157

原创 LeetCode 662 二叉树最大宽度

二叉树最大宽度/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * };...

2019-08-30 18:15:17 166

原创 LeetCode 873 最长的斐波那契子序列的长度

最长的斐波那契子序列的长度class Solution {public: int lenLongestFibSubseq(vector<int>& A) { //使用动态规划算法 int max_len=0; int len=A.size(); if(len<=2) re...

2019-08-29 22:49:34 240

原创 LeetCode 212 单词搜索 II

单词搜索 IIclass Solution {public: struct Node { int val; Node* child[26]; bool isWord = false; Node() { for (int i = 0; i < 26; ++i) child[i] = NULL; } }; Node* root=new No...

2019-08-29 21:46:32 262

原创 二叉树转换成链表和搜索二叉树转换成双链表

`二叉树转换成链表``/**Definition for a binary tree node.struct TreeNode {int val;TreeNode *left;TreeNode *right;TreeNode(int x) : val(x), left(NULL), right(NULL) {}};/class Solution {p...

2019-08-28 14:28:43 184

原创 二分查找变种

//求第一个等于target的数值void er_diyidengyu(vector<int>& nums, int target){ int len = nums.size(); int low = 0; int high = len-1; int mid; while (low < high) { mid = (low + high) / 2; ...

2019-08-27 15:27:53 99

原创 LeetCode-300 最长上升子序列

最长上升子序列class Solution {public: vector<int> result; int lengthOfLIS(vector<int>& nums) { //使用贪心算法与二分查找算法进行相应的设计 int len=nums.size(); if(len==0) ...

2019-08-27 14:53:36 89

原创 判断一个点是否在在三角形和矩形

bool sanjiaoxing(){ auto x1 = pair<int, int>(1, 0); auto x2 = pair<int, int>(5, 0); auto x3 = pair<int, int>(3, 3); auto test = pair<int, int>(30, 2); int bijiao = (x2....

2019-08-26 20:52:24 154

原创 LeetCode 343 整数拆分

整数拆分class Solution {public: int integerBreak(int n) { //整数拆分的算法 vector<int> dp(n+1,INT_MIN); dp[1]=1; for(int i=2;i<=n;++i) { for(in...

2019-08-26 01:01:13 109

原创 LeetCode 410 分割数组的最大值

分割数组的最大值class Solution {public: int splitArray(vector<int>& nums, int m) { //使用动态规划的算法 int len = nums.size(); int min_max_result = INT_MAX; vector<vector<long long>> d...

2019-08-25 21:57:40 109

原创 求子矩阵的最大和

求子矩阵的最大和因为没有在OJ平台上跑,不保证没错误void juzhen(vector<vector<int>>& nums){ int col = nums.size(); int row = nums[0].size(); vector<vector<int>> total=nums; int max_result = I...

2019-08-25 18:40:59 367

原创 01背包和完全背包

参考:https://blog.csdn.net/na_beginning/article/details/62884939https://blog.csdn.net/na_beginning/article/details/62884939https://blog.csdn.net/Mr_Lewis/article/details/88051036

2019-08-25 16:25:21 67

原创 LeetCode 542 01 矩阵

01 矩阵class Solution {public: vector<vector<int>> updateMatrix(vector<vector<int>>& matrix) { int col = matrix.size(); int row = matrix[0].size(); ...

2019-08-25 15:20:11 372

原创 LeetCode 208 实现 Trie (前缀树)

实现 Trie (前缀树)struct Node { bool isWord = false; Node* child[26] = {};};class Trie { public: Node* root; /** Initialize your data structure here. */ Trie() { root = new Node(); } /**...

2019-08-20 18:40:21 149

原创 使用栈排序

stack<int> zhan_paixu2(stack<int> s){ stack<int> r; while (!s.empty()) { int temp = s.top(); s.pop(); while (!r.empty() && r.top()>temp) { s.push(r.top());...

2019-08-19 23:17:53 159

原创 LeetCode 950 按递增顺序显示卡牌

按递增顺序显示卡牌类似约瑟夫环的操作class Solution {public: vector<int> deckRevealedIncreasing(vector<int>& deck) { //约瑟夫环的使用模拟抽牌就行了,栈模拟放牌 sort(deck.begin(),deck.end()); ...

2019-08-19 22:37:27 117

原创 LeetCode 207 课程表

课程表class Solution {public: bool canFinish(int numCourses, vector<vector<int>>& prerequisites) { //图的深度或者宽度遍历算法,使用拓扑排序也是可行的而且相对来说简单一点 //建立映射机制进行相应的,直接拓扑排序吧 vector<int> ru...

2019-08-17 14:44:22 88

原创 LeetCode 529 扫雷游戏

扫雷游戏class Solution {public: int cal(int x, int y, vector<vector<char>>& board){ int col = board.size(); int row = board[0].size(); int dx[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };...

2019-08-17 12:56:27 208

原创 LeetCode 134 加油站

加油站class Solution {public: int canCompleteCircuit(vector<int>& gas, vector<int>& cost) { //使用贪心算法 int len1 = gas.size(); int result = 0; int current = 0; vector<in...

2019-08-16 22:52:34 116

原创 LeetCode 37 解数独

解数独class Solution {public: bool huisu(vector<vector<char>>& board, vector<vector<int>>& hang, vector<vector<int>>& lie, vector<vector<...

2019-08-16 00:22:24 65

原创 LeetCode 48 旋转图像

旋转图像class Solution {public: void rotate(vector<vector<int>>& matrix) { int col=matrix.size(); int row=matrix[0].size(); for(int i=0;i<col;++i) ...

2019-08-15 22:12:03 68

原创 LeetCode 39 组合总和

组合总和class Solution {public:vector<vector> result;vector<vector> combinationSum(vector& candidates, int target) {//使用回溯法的使用vector temp;int sum=0;int begin=0;DFS(candidates,tar...

2019-08-15 21:35:55 62

原创 LeetCode 36 有效的数独

有效的数独class Solution {public: bool isValidSudoku(vector<vector<char>>& board) { //使用回溯法进行有效的数独的方法的建立过程 vector<map<char, int>> hang(9); vector<map<char, int&...

2019-08-15 21:11:11 68

原创 LeetCode 4 寻找两个有序数组的中位数

寻找两个有序数组的中位数class Solution {public: //仿照别人自己理解写出来的d double find_k(int a_begin, int b_begin, vector<int>& nums1, vector<int>& nums2, int k){ if (a_begin >= nums1.siz...

2019-08-15 19:34:24 78

原创 素数伴侣

素数伴侣#include <cstdio>#include <cstring>#include <iostream>#include <string>#include <algorithm>#include <map>#include <vector>#include <fstream&gt...

2019-08-15 13:14:45 297

原创 LeetCode 319 灯泡开关

灯泡开关class Solution {public: int bulbSwitch(int n) { //所有的平方可以 int sum=0; while(sum*sum<=n) { sum=sum+1; } return sum-1; }};...

2019-08-14 23:07:45 96

原创 LeetCode 201 数字范围按位与

数字范围按位与class Solution {public: int rangeBitwiseAnd(int m, int n) { int result = m; int count=0; while(m<n) { m=m>>1; n=n>>1; ++count; ...

2019-08-14 23:00:31 118

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

二叉树中的最大路径和 int Maxsum(TreeNode* root, int& maxsum) { int currentsum=0; if(root==NULL) return 0; int left_max=Maxsum(root->left,maxsum); int right_ma...

2019-08-14 21:50:01 56

原创 LeetCode 129 求根到叶子节点数字之和

求根到叶子节点数字之和/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} ...

2019-08-14 20:59:11 89

原创 LeetCode 82 删除排序链表中的重复元素 II

删除排序链表中的重复元素 II/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public:...

2019-08-14 20:28:26 83

原创 LeetCode 80 删除排序数组中的重复项 II

删除排序数组中的重复项 IIclass Solution {public: int removeDuplicates(vector<int>& nums) { //删除数组中的重复元素 int len=nums.size(); if(len==0) return 0; int ...

2019-08-14 19:38:01 64

原创 LeetCode 61 旋转链表

旋转链表/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNo...

2019-08-14 18:24:31 70

原创 LeetCode 54 螺旋矩阵

螺旋矩阵class Solution {public: vector<int> spiralOrder(vector<vector<int>>& matrix) { //剑指offer的题目 vector<int> result; int col = matrix.size(); if (col == 0) retu...

2019-08-14 17:12:58 57

原创 LeetCode 51 N皇后

N皇后class Solution {public: vector<vector<string>> result;void DFS(int count, int n, vector<int>& jilu){ if (count == n) { vector<string> temp; for (int i = 0...

2019-08-14 15:48:00 108 1

原创 LeetCode 73 矩阵置零

矩阵置零class Solution {public: void setZeroes(vector<vector<int>>& matrix) { //使用回溯法来做 int col=matrix.size(); if(col==0) return; ...

2019-08-14 15:04:00 50

原创 LeetCode 127 单词接龙

单词接龙时间超时class Solution {public: bool isvalue(string s1, string s2){ int len = s1.size(); int count = 0; for (int i = 0; i<len; ++i) { if (s1[i] != s2[i]) ++count; } if (count ==...

2019-08-12 17:05:56 171

原创 LeetCode 138 复制带随机指针的链表

复制带随机指针的链表/*// Definition for a Node.class Node {public: int val; Node* next; Node* random; Node() {} Node(int _val, Node* _next, Node* _random) { val = _val; ...

2019-08-12 13:27:35 80

集成算法讲解ppt

集成算法PPT包括Bagging和AdaBoost

2015-11-05

空空如也

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

TA关注的人

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