1. 题目描述 2. 代码 1 class Solution: 2 def removeDuplicates(self, nums: 'List[int]') -> int: 3 prevalue = 0 4 n = len(nums) 5 count = 0 6 i,j = 0,0 7 while ...
分类:
编程语言 时间:
2020-11-02 09:55:41
阅读次数:
32
5556. 可以到达的最远建筑 刚开始写得时候感觉像贪心,但没分析好不敢写,自己写了个记忆化搜索,后来看讲解把贪心法给补上 记忆化搜索 const int MAXN = 1e5+50; class Solution { public: int dp[MAXN]; int dfs(int now, v ...
分类:
其他好文 时间:
2020-11-01 22:29:28
阅读次数:
84
-- 查询具体表的分区目录 select t1.NAME, t2.TBL_NAME,t4.PART_NAME, t3.LOCATION from DBS t1, TBLS t2 , SDS t3 ,PARTITIONSt4 where t1.DB_ID=t2.DB_ID and t4.SD_ID = ...
分类:
其他好文 时间:
2020-11-01 21:29:48
阅读次数:
24
class Solution { public: ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) { auto dummy = new ListNode(-1), cur = dummy; int t = 0; while(l1 || l2 | ...
分类:
其他好文 时间:
2020-11-01 20:59:38
阅读次数:
11
class Solution { public boolean isPowerOfTwo(int n) { return n > 0 && (n & (n-1)) == 0; } } 这里引用评论区Kico大神的解释。 ...
分类:
其他好文 时间:
2020-11-01 10:15:58
阅读次数:
8
给定一个二叉树,返回它的 前序 遍历。 示例: 输入: [1,null,2,3] 1 \ 2 / 3 输出: [1,2,3] 进阶: 递归算法很简单,你可以通过迭代算法完成吗? 递归: 思路: 1.先序遍历,采用的是先根,再左,再右的方式 2.而在访问左子树或者右子树的时候,我们按照同样的方式遍历, ...
分类:
其他好文 时间:
2020-10-31 01:34:45
阅读次数:
19
leetcode_easy_array problem 1486. XOR Operation in an Array solution #1: code: 参考 1. leetcode_1486. XOR Operation in an Array; 完 ...
分类:
其他好文 时间:
2020-10-30 12:53:24
阅读次数:
17
当我按照官方的思路写出代码,提交后并未通过,查看错误,发现算法错误的将[2147483647,-2147483648]也视为连续的整数了,这是因为我没有考虑到int类型的边界。将代码稍加修改,即成功提交 //哈希表,建议看官方的题解,尤其是演示动画 class Solution { public i ...
分类:
其他好文 时间:
2020-10-29 10:20:41
阅读次数:
23
use 3D version to calculate how much water the model can contain this problem need use dfs,from the edge part which mustn't be answer,for the edge can ...
分类:
移动开发 时间:
2020-10-29 10:06:29
阅读次数:
25
//通过哈希表来查重 class Solution { public boolean containsDuplicate(int[] nums) { Set<Integer> set = new HashSet<>(); for(int i = 0;i < nums.length;i++){ if( ...
分类:
其他好文 时间:
2020-10-29 10:06:06
阅读次数:
17