Leetcode-题解
文章平均质量分 90
qq_34287501
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
展开
-
Leetcode- 1-5题 题解
最近开始刷Leetcode了,大三狗还没有找到实习,很菜啊,希望明年三月份能找份实习工作吧!2017年最后一篇博客,明天都元旦了,提前对大家说元旦快乐哈!下面所有代码在我GitHub上也有,地址:https://github.com/zzuliLL/Leetcode-1. Two SumGiven an array of integers, return indices o原创 2017-12-31 21:55:36 · 317 阅读 · 1 评论 -
56-60题 题解
56. Merge IntervalsGiven a collection of intervals, merge all overlapping intervals.For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18].//不明白排序函数为什么要写成静态的/** *原创 2018-01-31 21:40:35 · 370 阅读 · 0 评论 -
51-55题 题解
51. N-QueensThe n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the原创 2018-01-31 21:33:37 · 337 阅读 · 0 评论 -
46-50题 题解
46. PermutationsGiven a collection of distinct numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1],原创 2018-01-31 21:26:41 · 295 阅读 · 0 评论 -
41-45题 题解
41. First Missing PositiveGiven an unsorted integer array, find the first missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm should run原创 2018-01-31 21:19:32 · 287 阅读 · 0 评论 -
36-40题 题解
36. Valid SudokuDetermine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character '.'.原创 2018-01-31 21:13:22 · 246 阅读 · 0 评论 -
31-35题 题解
31. Next PermutationImplement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearran原创 2018-01-31 21:06:31 · 383 阅读 · 0 评论 -
26-30题 题解
26. Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in-place such that each element appear only once and return the new length.Do not allocate extra space原创 2018-01-31 20:59:18 · 212 阅读 · 0 评论 -
21-25题 题解
21. Merge Two Sorted ListsMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Example:Input: 1->2原创 2018-01-31 20:48:33 · 256 阅读 · 0 评论 -
Leetcode- 06-10题 题解
6. ZigZag ConversionThe string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibil原创 2018-01-03 10:17:00 · 323 阅读 · 0 评论 -
Leetcode- 16-20题 题解
16. 3Sum ClosestGiven 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 each原创 2018-01-05 20:32:21 · 372 阅读 · 0 评论 -
Leetcode- 11-15题 题解
11. Container With Most WaterGiven n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of l原创 2018-01-04 21:49:56 · 206 阅读 · 0 评论 -
61-65题 题解
61. Rotate ListGiven a list, rotate the list to the right by k places, where k is non-negative.Example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.//如果k大于链表长度时,应原创 2018-01-31 21:49:16 · 415 阅读 · 0 评论