LeetCode
三回啊三回
这个作者很懒,什么都没留下…
展开
-
leetcode 31. Next Permutation 遇到函数不返回值的要求,但是原参数未被修改的问题
做leetcode31题的时候有个要求是不要将答案返回而是修改原参数Do not return anything, modify nums in-place instead.题目是对给定的数,给出刚好大于当前组合的组合Implementnext permutation, which rearranges numbers into the lexicographically next ...原创 2019-12-08 17:21:50 · 754 阅读 · 0 评论 -
LeetCode 2. Add Two Numbers
之前写的东西都是老师课上要求随便应付的,春招快开始了要认真刷题了。Orz c++给的参数是指针访问:ListNode* l1,复习一下.和->的区别; ->是指针类型,指针引用; .是实例。 所以*l1.val相当于l1->val。 需要一个始终指向当前节点的x,用sum记录当前节点对应的l1与l2数字的和,存在就把val加上,不存在就不加,还要加上进...原创 2018-12-28 19:55:00 · 145 阅读 · 0 评论 -
LeetCode 3. Longest Substring Without Repeating Characters
问题:Given a string, find the length of the longest substring without repeating characters. 首先是题目的第三个例子:Input: "pwwkew"Output: 3Explanation: The answer is"wke", with the length of 3. Note tha...原创 2018-12-29 16:29:21 · 208 阅读 · 0 评论 -
LeetCode contest 118 第一题 970. Powerful Integers
题目:Given two non-negative integers x and y, an integer is powerful if it is equal to x^i + y^j for some integers i >= 0 and j >= 0.Return a list of all powerful integers that have value less...原创 2019-01-06 12:02:16 · 278 阅读 · 0 评论 -
LeetCode contest 119 第一题 973. K Closest Points to Origin
题目:We have a list of points on the plane. Find the K closest points to the origin (0, 0).(Here, the distance between two points on a plane is the Euclidean distance.)You may return the answer i...原创 2019-01-13 12:17:13 · 237 阅读 · 0 评论