小堃哥的专栏

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

leetcode637+ 求二叉树每一层sum的average+BFS

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

2018-09-29 00:30:33

阅读数 33

评论数 0

leetcode633+判断一个数是否为两个数的平方和

https://leetcode.com/problems/sum-of-square-numbers/description/ class Solution { public: bool judgeSquareSum(int c) { int limit = sqrt...

2018-09-28 14:59:27

阅读数 338

评论数 0

leetcode628+ array中取三个数乘积最大

https://leetcode.com/problems/maximum-product-of-three-numbers/description/ class Solution { public: int maximumProduct(vector<int&...

2018-09-20 22:12:33

阅读数 31

评论数 0

leetcode617+两个二叉树合并,DP

https://leetcode.com/problems/merge-two-binary-trees/description/ struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeN...

2018-09-19 20:23:57

阅读数 36

评论数 0

leetcode606+二叉树的形式化输出,递归

https://leetcode.com/problems/construct-string-from-binary-tree/description/ struct TreeNode { int val; TreeNode *left; TreeNode *righ...

2018-09-09 20:39:15

阅读数 79

评论数 0

leetcode564+找到最近的回文数,改变右半边

https://leetcode.com/problems/find-the-closest-palindrome/description/ class Solution { public: string nearestPalindromic(string n) { l...

2018-09-05 22:03:34

阅读数 159

评论数 0

leetcde599+求出现相同单词的索sum最小,map进行hash

https://leetcode.com/problems/minimum-index-sum-of-two-lists/description/ class Solution { public: vector<string> findRes...

2018-09-05 21:52:02

阅读数 25

评论数 0

leetcode605+判断是否能完全放完花,左右添加0,trick

https://leetcode.com/problems/can-place-flowers/description/ class Solution { public: bool canPlaceFlowers(vector<int>&am...

2018-09-04 23:28:05

阅读数 20

评论数 0

leetcode598+求最多的覆盖面积,是从左上角开始到(m,n),因此要求出最下的横坐标和纵坐标

https://leetcode.com/problems/range-addition-ii/description/ class Solution { public: int maxCount(int m, int n, vector<vector&a...

2018-09-04 23:02:44

阅读数 35

评论数 0

leetcode594+最长和谐子序列,使用map进行hash统计

https://leetcode.com/problems/longest-harmonious-subsequence/description/ class Solution { public: int findLHS(vector<int&gt...

2018-09-04 22:10:16

阅读数 30

评论数 0

leetcode593+判断四个点是不是组成了正方形,看所有点的距离是不是只有两种

https://leetcode.com/problems/valid-square/description/ class Solution { public: bool validSquare(vector<int>&amp...

2018-09-04 21:51:13

阅读数 138

评论数 0

leetcode592+流式计算一堆分数的结果,字符流操作

https://leetcode.com/problems/fraction-addition-and-subtraction/description/ class Solution { public: int gcd(int a, int b) { retur...

2018-09-03 23:36:58

阅读数 43

评论数 0

leetcode590+多叉树的后序遍历,递归

https://leetcode.com/problems/n-ary-tree-postorder-traversal/description/ /* // Definition for a Node. class Node { public: int val; vector...

2018-09-03 22:56:17

阅读数 226

评论数 0

leetcode589+多叉树的前序遍历,递归

https://leetcode.com/problems/n-ary-tree-preorder-traversal/description/ /* // Definition for a Node. class Node { public: int val; vector&...

2018-09-03 22:54:57

阅读数 263

评论数 0

leetcode583+删除元素是两string最终一样,最长公共子序列变版

https://leetcode.com/problems/delete-operation-for-two-strings/description/ class Solution { public: int minDistance(string word1, string word2...

2018-09-03 21:52:00

阅读数 40

评论数 0

leetcode581+求最短未排序数组长度

https://leetcode.com/problems/shortest-unsorted-continuous-subarray/description/ class Solution { public: int findUnsortedSubarray(vector&a...

2018-09-02 17:39:34

阅读数 41

评论数 0

leetcode575+分糖果种类数尽量多,hash

https://leetcode.com/problems/distribute-candies/description/ class Solution { public: int distributeCandies(vector<int>&...

2018-09-02 12:11:51

阅读数 59

评论数 0

leetcode572+判断t是否和s的某一个subtree一样,递归

https://leetcode.com/problems/subtree-of-another-tree/description/ /** * Definition for a binary tree node. * struct TreeNode { * int val; ...

2018-09-02 10:30:01

阅读数 21

评论数 0

leetcode576+多少种方案出去网格,Dp

https://leetcode.com/problems/out-of-boundary-paths/description/ class Solution { public: int findPaths(int m, int n, int N, int i, int j) { ...

2018-09-02 00:11:08

阅读数 78

评论数 0

leetcode567+判断s1的全排列一种是否是s1的子串,sliding window,hash

https://leetcode.com/problems/permutation-in-string/description/ class Solution { public: bool checkInclusion(string s1, string s2) { i...

2018-09-01 17:34:47

阅读数 115

评论数 0

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