![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
快乐遇见忧伤
这个作者很懒,什么都没留下…
展开
-
565 Array Nesting
题目想法MyCodeTime Limit Exceeded SolutionAccept SolutionOther Classic Solutionsolution oneBest solution题目A zero-indexed array A of length N contains all integers from 0 to N-1. Fin...原创 2018-06-24 16:55:25 · 167 阅读 · 0 评论 -
561 Array Partition I
题目Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), …, (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as po...原创 2018-06-24 16:55:17 · 160 阅读 · 0 评论 -
题号:15 题目名:3Sum
题目想法Code问题题目Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The soluti...原创 2018-06-24 16:54:50 · 248 阅读 · 0 评论 -
53
includeincludeincludeinclude includeusing namespace std;class Solution { public: int maxSubArray(vector& nums) { vector tp = nums; int large_sum ; ...原创 2018-06-24 16:55:01 · 368 阅读 · 0 评论 -
题号:16 题目: 3Sum Closest
问题想法Code问题问题Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that ea...原创 2018-06-24 16:55:32 · 170 阅读 · 0 评论 -
18 4Sum
题目CodeMyCode问题题目Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of ta...原创 2018-06-24 16:55:41 · 208 阅读 · 0 评论 -
翻转链表
//思路为将节点从前到后依次放到表头,最后最后的节点到了最前面,最前面的节点到了最后面ListNode * ReverseList(ListNode * head){ //如果链表为空或者链表中只有一个元素 if(head==NULL || head->m_pNext==NULL) return head; ListNode * p=head->m...转载 2018-06-24 16:54:40 · 154 阅读 · 0 评论 -
27. Remove Element
题目想法Code题目Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array, you must do this by mo...原创 2018-06-24 16:54:27 · 209 阅读 · 0 评论 -
26. Remove Duplicates from Sorted Array
题目想法Code题目Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length. Do not allocate extra space for another array, you...原创 2018-06-24 16:54:04 · 194 阅读 · 0 评论