小堃哥的专栏

写博客:网址链接+名称:oj名+所用算法名称+该题注意事项和心得

排序:
默认
按更新时间
按访问量

HDOJ+DFS使用了stack+貌似题目设计不合理,那个方向数组+DFS的标记和stack模板

点击打开链接///确定最大递归深度,确定递归终止条件,确定每层递归做什么 #include #include #include #include #include #include #include #include #include #define INF 0x3f3f3f3f using na...

2016-02-24 17:15:57

阅读数:329

评论数:0

leetcode732+calender|||+hash map判断end点最多的值

https://leetcode.com/problems/my-calendar-iii/description/ class MyCalendarThree { public: map<int, int> m; int maxim...

2018-11-17 15:32:46

阅读数:4

评论数:0

leetcode713+子数组小于K是多少个,滑动窗口,双指针

https://leetcode.com/problems/subarray-product-less-than-k/description/ class Solution { public: int numSubarrayProductLessThanK(vector&am...

2018-11-16 21:27:51

阅读数:10

评论数:0

leetcode744+找出最小的比当前大的字母,二分

https://leetcode.com/problems/find-smallest-letter-greater-than-target/description/ class Solution { public: char nextGreatestLetter(vector&...

2018-11-15 14:39:08

阅读数:7

评论数:0

leetcode752+从一串数字号码到另一串数字号码变化最少步数,BFS

https://leetcode.com/problems/open-the-lock/description/ class Solution { public: int openLock(vector<string>&amp...

2018-11-12 18:55:46

阅读数:4

评论数:0

leetcode739+判断每一位数字后面比他第一个大的数字相差位置,stack

https://leetcode.com/problems/daily-temperatures/description/ class Solution { public: vector<int> dailyTemperatures(vect...

2018-11-09 11:50:04

阅读数:14

评论数:0

leetcode738+构造不大于n的单调递增数字,贪心

https://leetcode.com/problems/monotone-increasing-digits/description/ class Solution { public: int monotoneIncreasingDigits(int N) { st...

2018-11-08 12:02:24

阅读数:8

评论数:0

leetcode717+判断bit数组最后一位是否为0,贪心

https://leetcode.com/problems/1-bit-and-2-bit-characters/description/ class Solution { public: bool isOneBitCharacter(vector<int&...

2018-11-07 11:04:21

阅读数:12

评论数:0

leetcode712+减少最少的字母凑成相同序列,最长公共子序列变形,DP

https://leetcode.com/problems/minimum-ascii-delete-sum-for-two-strings/description/ class Solution { public: int minimumDeleteSum(string s1, st...

2018-11-07 10:39:32

阅读数:9

评论数:0

leetcode718+就是最长公共字串,Dp

https://leetcode.com/problems/maximum-length-of-repeated-subarray/description/ class Solution { public: int findLength(vector<int&am...

2018-11-06 17:13:30

阅读数:10

评论数:0

leetcode714+买卖股票带交易费,两个变量DP

https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee/description/ class Solution { public: int maxProfit(vector&a...

2018-11-05 11:59:48

阅读数:12

评论数:0

leetcode668+乘法表第K小的数字,使用最大堆或者二分

https://leetcode.com/problems/kth-smallest-number-in-multiplication-table/description/ class Solution { public: int findKthNumber(int m, int n,...

2018-11-04 13:16:54

阅读数:11

评论数:0

leecode829+判断一个数是否由一段连续数字求和,数学

https://leetcode.com/problems/consecutive-numbers-sum/description/ class Solution { public: int consecutiveNumbersSum(int N) { int cnt ...

2018-10-30 21:41:06

阅读数:20

评论数:0

leetcode703+第k大的数字,最小堆使用

https://leetcode.com/problems/kth-largest-element-in-a-stream/description/ class KthLargest { public: int size; priority_queue<i...

2018-10-29 23:34:13

阅读数:15

评论数:0

leetcode700+找出二叉树中的某值,递归

https://leetcode.com/problems/search-in-a-binary-search-tree/description/ struct TreeNode { int val; TreeNode *left; TreeNode *right; ...

2018-10-29 22:45:24

阅读数:6

评论数:0

leetcode693+判断二进制是否相连不同数字

https://leetcode.com/problems/binary-number-with-alternating-bits/description/ class Solution { public: bool hasAlternatingBits(int n) { ...

2018-10-29 20:46:30

阅读数:8

评论数:0

leetcode678+括号匹配,stack使用掌握规

https://leetcode.com/problems/valid-parenthesis-string/description/ class Solution { public: bool checkValidString(string s) { stack&am...

2018-10-28 19:03:41

阅读数:38

评论数:0

leetcode671+二叉树中第二小的值,先搜索,然后存储到set中。

https://leetcode.com/problems/second-minimum-node-in-a-binary-tree/description/ /** * Definition for a binary tree node. * struct TreeNode { * ...

2018-10-27 17:05:14

阅读数:10

评论数:0

leetcode686+重复A是否有字串B,重复有规律,重复一定就不用重复了

https://leetcode.com/problems/repeated-string-match/description/ //A比B的长度要短,这时A要不断增加。 2. A 比 B 刚好长, //3、A 比 B 刚好长的长度 + 1个A的长度, 这时能够保证在A的原始的串中能够索引...

2018-10-27 13:30:46

阅读数:11

评论数:0

leetcode690+典型树自上而下递归

https://leetcode.com/problems/employee-importance/description/ /* // Employee info class Employee { public: // It's the unique ID of each node....

2018-10-27 12:07:27

阅读数:10

评论数:0

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