已注销
已注销
全部文章
分类
leetCode题解(5)
剑指offer题解(1)
归档
标签
去牛客网
登录
/
注册
已注销的博客
全部文章
(共6篇)
leetCode 动态规划2
338. 比特位计数 //枚举的话 nlogn的 //n 的话 : //用之前计算的结果 //f[n]: f[n/2]算过了 //f[n] = f[n/2] + 1(奇数时候加一) class Solution { public int[] countBits(int num...
2019-08-04
0
474
LeetCode上的经典动态规划问题
63. 不同路径II 动态规划: 1. 状态表示:每个格子表示到那个格子的方案数量 2. 状态计算:每个格子由上和左求和决定,当格子为1时候,直接记为0. 3. 初始状态:dp[0][0] = 1- nums[0][0]。 class Solution { publ...
2019-08-04
0
510
树专题
1. 验证是不是二叉搜索树 https://leetcode-cn.com/problems/validate-binary-search-tree/submissions/ class Solution { public boolean isValidBST(TreeNode ro...
2019-07-29
0
549
各种排序模板
1. 快速排序: 递归法: public static void QuickSort(int[] A, int l, int r) { if (l >= r) return; int i = l, j = r; int pivot = A[i]; while(i < j...
2019-07-28
0
535
LeetCode几道经典题
1. 数组的全排列: https://leetcode-cn.com/problems/permutations/submissions/ 回溯法 class Solution { public List<List<Integer>> permute(i...
2019-07-28
0
529
剑指offer题解(Java版),可读性高,尽量最优解
本文为牛客网上66道剑指offer题解 1. 二叉树与双向链表 https://www.nowcoder.com/practice/947f6eb80d944a84850b0538bf0ec3a5?tpId=13&tqId=11179&tPage=2&rp=1&a...
2019-07-21
0
967