码迷,mamicode.com
首页 >  
搜索关键字:leetcode 19    ( 34993个结果
LeetCode 80 删除数组中的重复项
LeetCode80 删除数组中的重复项 题目描述 给定一个增序排列数组 nums ,你需要在 原地 删除重复出现的元素,使得每个元素最多出现两次,返回移除后数组的新长度。 不要使用额外的数组空间,你必须在 原地 修改输入数组 并在使用 O(1) 额外空间的条件下完成。 样例 输入:nums = [ ...
分类:编程语言   时间:2020-11-24 12:11:47    阅读次数:6
LeetCode 81 搜索旋转排序数组II
LeetCode81 搜索旋转排序数组II 题目描述 假设按照升序排序的数组在预先未知的某个点上进行了旋转。 ( 例如,数组 [0,0,1,2,2,5,6] 可能变为 [2,5,6,0,0,1,2] )。 编写一个函数来判断给定的目标值是否存在于数组中。若存在返回 true,否则返回 false。 ...
分类:编程语言   时间:2020-11-24 12:11:34    阅读次数:7
[LeetCode] 200. Number of Islands(岛屿的数目)
Difficulty: Medium Related Topics: Depth-first Search, Breadth-first Search, Union Find Link: https://leetcode.com/problems/number-of-islands/ Descrip ...
分类:其他好文   时间:2020-11-23 12:25:21    阅读次数:3
[LeetCode] 17. Letter Combinations of a Phone Number(手机的 T9 输入法)
Difficulty: Medium Related Topics: String, Backtracking Link: https://leetcode.com/problems/letter-combinations-of-a-phone-number/ Description Given a ...
分类:移动开发   时间:2020-11-21 12:45:15    阅读次数:31
4. 寻找两个正序数组的中位数 Median of Two Sorted Arrays
Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. The overall run time complexity shou ...
分类:编程语言   时间:2020-11-21 12:37:58    阅读次数:15
微软面试题: LeetCode 543. 二叉树的直径出现次数:3
题目描述: 给定一棵二叉树,你需要计算它的直径长度。一棵二叉树的直径长度是任意两个结点路径长度中的最大值。 这条路径可能穿过也可能不穿过根结点。 分析: 本题和 124. 二叉树中的最大路径和 是一样的思想 ,124 题是在二叉树中 求一条路径 使得这条路径上的 节点和最大。本题是在二叉树树中找一条 ...
分类:其他好文   时间:2020-11-21 11:56:08    阅读次数:3
Leetcode(Daily 11-8 ~ 11-14)
leetcode(daily 11-8 ~ 11-14) leetcode 每日一题 11-8 122. 买卖股票的最佳时机 II class Solution { public int maxProfit(int[] prices) { // 贪心算法:只要今天买明天赚就买入 // profit用 ...
分类:其他好文   时间:2020-11-20 12:09:49    阅读次数:9
渣渣的Leetcode之旅(Python3)_300.最长上升子序列
给定一个无序的整数数组,找到其中最长上升子序列的长度。 示例:输入: [10,9,2,5,3,7,101,18]输出: 4解释: 最长的上升子序列是 [2,3,7,101],它的长度是 4。 注意:如果输入[]的话,自然输出0如果输入[1]或者[2]之类包含一个值的输入,应该输出1,一开始我以为是也 ...
分类:编程语言   时间:2020-11-20 12:02:19    阅读次数:9
leetcode 116. Populating Next Right Pointers in Each Node
You are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The binary tree has the following defin ...
分类:其他好文   时间:2020-11-20 12:00:39    阅读次数:9
LeetCode-680-验证回文字符串 Ⅱ
给定一个非空字符串 s,最多删除一个字符。判断是否能成为回文字符串。 image.png 解题思路: 判断是否回文字符串:isPalindrome = lambda x: x==x[::-1],即将字符串x倒置,还和原来的一样; 如何判断删除一个字符后还是回文字符串?假设字符串s='abccbca' ...
分类:其他好文   时间:2020-11-20 11:39:00    阅读次数:5
34993条   上一页 1 ... 57 58 59 60 61 ... 3500 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!