码迷,mamicode.com
首页 >  
搜索关键字:part solution    ( 14980个结果
LeetCode 26 _ 删除排序数组中的重复项
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
leetcode213周赛
5556. 可以到达的最远建筑 刚开始写得时候感觉像贪心,但没分析好不敢写,自己写了个记忆化搜索,后来看讲解把贪心法给补上 记忆化搜索 const int MAXN = 1e5+50; class Solution { public: int dp[MAXN]; int dfs(int now, v ...
分类:其他好文   时间:2020-11-01 22:29:28    阅读次数:84
hive查询分区元数据,PARTITIONED BY
-- 查询具体表的分区目录 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
LeetCode 2.两数之和
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
LeetCode 231. 2的幂
class Solution { public boolean isPowerOfTwo(int n) { return n > 0 && (n & (n-1)) == 0; } } 这里引用评论区Kico大神的解释。 ...
分类:其他好文   时间:2020-11-01 10:15:58    阅读次数:8
二叉树的前序遍历【144】
给定一个二叉树,返回它的 前序 遍历。 示例: 输入: [1,null,2,3] 1 \ 2 / 3 输出: [1,2,3] 进阶: 递归算法很简单,你可以通过迭代算法完成吗? 递归: 思路: 1.先序遍历,采用的是先根,再左,再右的方式 2.而在访问左子树或者右子树的时候,我们按照同样的方式遍历, ...
分类:其他好文   时间:2020-10-31 01:34:45    阅读次数:19
【leetcode_easy】1486. XOR Operation in an Array
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
LeetCode 128. 最长连续序列
当我按照官方的思路写出代码,提交后并未通过,查看错误,发现算法错误的将[2147483647,-2147483648]也视为连续的整数了,这是因为我没有考虑到int类型的边界。将代码稍加修改,即成功提交 //哈希表,建议看官方的题解,尤其是演示动画 class Solution { public i ...
分类:其他好文   时间:2020-10-29 10:20:41    阅读次数:23
leetcode407 Trapping rain water II
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
LeetCode 217. 存在重复元素
//通过哈希表来查重 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
14980条   上一页 1 ... 42 43 44 45 46 ... 1498 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!