码迷,mamicode.com
首页 >  
搜索关键字:leetcode happy numbe    ( 36157个结果)
leetcode 223 Rectangle Area
https://leetcode.com/problems/rectangle-area/discuss/705462/C-36-ms-100-O(1)-15.4-mb-100-O(1) class Solution { public: int computeArea(int A, int B, i ...
分类:其他好文   时间:2020-06-26 11:04:08    阅读次数:54
[LeetCode] 1282. Group the People Given the Group Size They Belong To
There are n people whose IDs go from 0 to n - 1 and each person belongs exactly to one group. Given the array groupSizes of length n telling the group ...
分类:其他好文   时间:2020-06-26 11:00:48    阅读次数:51
leetcode-1488-避免洪水泛滥
题目描述: 提交: class Solution: from typing import List def avoidFlood(self, rains: List[int]) -> List[int]: import heapq heap = [] res = [-1 if i != 0 else ...
分类:其他好文   时间:2020-06-26 11:00:34    阅读次数:70
[LeetCode] 1060. Missing Element in Sorted Array
Given a sorted array A of unique numbers, find the K-th missing number starting from the leftmost number of the array. Example 1: Input: A = [4,7,9,10 ...
分类:其他好文   时间:2020-06-26 10:52:26    阅读次数:72
++i和i++的分析
#i和i的运行分析 今天在刷leetcode的三数之和时,写错i与i。一直只能搜索到一个解,遂百度,发现一个有趣的问题。 int a=0; int a=a++; cout<<a; 结果不是1,而是0!!!。看到一篇博客(链接忘了)阐明的原理,大概如下: ##i++ type tmp=i; i=i+1 ...
分类:其他好文   时间:2020-06-26 01:41:24    阅读次数:75
leetcode-206反转链表
#题目:206反转链表 我的解答: public ListNode reverseList(ListNode head) { ListNode tail=null; ListNode mid=null; while(head!=null){ mid=head; mid.next=tail; tail ...
分类:其他好文   时间:2020-06-25 23:45:27    阅读次数:54
leetcode-----31. 下一个排列
链接:https://leetcode-cn.com/problems/next-permutation/ 代码 class Solution { public: void nextPermutation(vector<int>& nums) { int k = nums.size() - 1; w ...
分类:其他好文   时间:2020-06-25 23:30:17    阅读次数:53
leetcode-----33. 搜索旋转排序数组
链接:https://leetcode-cn.com/problems/search-in-rotated-sorted-array/ 思路 找出两段;通过找出满足条件:第一段的数字都大于第一个数。 第一次二分找出分段点,第二次二分求解。 代码 class Solution { public: in ...
分类:编程语言   时间:2020-06-25 23:26:56    阅读次数:60
leetcode-----32. 最长有效括号
链接:https://leetcode-cn.com/problems/longest-valid-parentheses/ 思路 将整个序列分段,即刚刚不满足左括号数量大于等于右括号数量条件的情况;则任何一个合法序列在每个段内。 使用栈来存储位置。 代码 class Solution { publ ...
分类:其他好文   时间:2020-06-25 23:22:59    阅读次数:45
468. Validate IP Address
package LeetCode_468 /** * 468. Validate IP Address * https://leetcode.com/problems/validate-ip-address/description/ * * Write a function to check whe ...
分类:其他好文   时间:2020-06-25 23:14:31    阅读次数:48
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!