码迷,mamicode.com
首页 >  
搜索关键字:leetcode happy numbe    ( 36157个结果)
leetcode-----66. 加一
链接:https://leetcode-cn.com/problems/plus-one/ 代码 class Solution { public: vector<int> plusOne(vector<int>& digits) { int t = 1; for (int i = digits.si ...
分类:其他好文   时间:2020-07-08 21:27:49    阅读次数:43
LeetCode 面试题 16.11. 跳水板 | Python
面试题 16.11. 跳水板 题目来源:力扣(LeetCode)https://leetcode-cn.com/problems/diving-board-lcci 题目 你正在使用一堆木板建造跳水板。有两种类型的木板,其中长度较短的木板长度为 shorter,长度较长的木板长度为 longer。你 ...
分类:编程语言   时间:2020-07-08 20:09:02    阅读次数:65
leetcode刷题总结251-300
251-256.。 257. 二叉树的所有路径 描述: 思路:递归(几乎所有的树的遍历等操作都可以用递归) 258. 各位相加 描述: 输入: 38 输出: 2 解释: 各位相加的过程为:3 + 8 = 11, 1 + 1 = 2。 由于 2 是一位数,所以返回 2。 思路:按照思路 259.。。。 ...
分类:其他好文   时间:2020-07-08 19:43:53    阅读次数:62
【刷题-LeetCode】164 Maximum Gap
Maximum Gap Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Return 0 if the array contains le ...
分类:其他好文   时间:2020-07-08 15:25:35    阅读次数:52
Leetcode-136. 只出现一次的数字
给定一个非空整数数组,除了某个元素只出现一次以外,其余每个元素均出现两次。找出那个只出现了一次的元素。 说明: 你的算法应该具有线性时间复杂度。 你可以不使用额外空间来实现吗? 示例 1: 输入: [2,2,1]输出: 1示例 2: 输入: [4,1,2,1,2]输出: 4 来源:力扣(LeetCo ...
分类:其他好文   时间:2020-07-08 15:07:58    阅读次数:51
【LeetCode】328. 奇偶链表
【题目描述】 给定一个单链表,把所有的奇数节点和偶数节点分别排在一起。请注意,这里的奇数节点和偶数节点指的是节点编号的奇偶性,而不是节点的值的奇偶性。 请尝试使用原地算法完成。你的算法的空间复杂度应为 O(1),时间复杂度应为 O(nodes),nodes 为节点总数。 示例 1: 输入: 1->2 ...
分类:其他好文   时间:2020-07-08 13:44:21    阅读次数:63
LeetCode 面试题 16.11.. 跳水板 模拟
地址 https://leetcode-cn.com/problems/diving-board-lcci/ 你正在使用一堆木板建造跳水板。有两种类型的木板,其中长度较短的木板长度为shorter,长度较长的木板长度为longer。你必须正好使用k块木板。编写一个方法,生成跳水板所有可能的长度。 返 ...
分类:其他好文   时间:2020-07-08 13:22:14    阅读次数:45
【刷题-LeetCode】162 Find Peak Element
Find Peak Element A peak element is an element that is greater than its neighbors. Given an input array nums, where nums[i] ≠ nums[i+1], find a peak e ...
分类:其他好文   时间:2020-07-08 13:03:15    阅读次数:33
面试题 16.11. 跳水板(leetcode)-7月8日
题目 面试题 16.11. 跳水板(leetcode) 我的思路 数学方法,一共k+1种情况:使用shorter0次到k次。一个循环把i*shorter+(k-i)*longer,0<=i<=k算一遍即可。 我的实现 class Solution { public: vector<int> divi ...
分类:其他好文   时间:2020-07-08 10:24:19    阅读次数:64
547. Friend Circles
package LeetCode_547 import java.util.* /** * 547. Friend Circles * https://leetcode.com/problems/friend-circles/description/ * * There are N students ...
分类:其他好文   时间:2020-07-08 01:03:19    阅读次数:71
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!