### 基础算法

leetcode算法题(编程语言C++、Java）

5 已关注
242篇博文
• #### 41. First Missing Positive

题目 Given an unsorted integer array, find the first missing positive integer. For example, Giv...

2018-03-05 11:28
65
• #### 42. Trapping Rain Water

题目 Given n non-negative integers representing an elevation map where the width of each bar is 1, ...

2018-03-05 15:20
64
• #### 91. Decode Ways

题目 A message containing letters from A-Z is being encoded to numbers using the following mapping: ...

2018-03-13 10:42
81
• #### 766. Toeplitz Matrix

题目 A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element. Now ...

2018-03-14 13:23
72
• #### 695. Max Area of Island

题目 Given a non-empty 2D array grid of 0’s and 1’s, an island is a group of 1’s (representing land) ...

2018-03-19 09:45
61
• #### 717. 1-bit and 2-bit Characters

题目 We have two special characters. The first character can be represented by one bit 0. The second ...

2018-03-19 16:01
55
• #### 122. Best Time to Buy and Sell Stock II

题目 Say you have an array for which the ith element is the price of a given stock on day i. Design ...

2018-03-19 17:45
60
• #### 697. Degree of an Array

题目 Given a non-empty array of non-negative integers nums, the degree of this array is defined as th...

2018-03-19 19:58
83
• #### 767. Reorganize String

题目 Given a string S, check if the letters can be rearranged so that two characters that are adjacen...

2018-02-28 15:08
101
• #### 324. Wiggle Sort II

题目 Given an unsorted array nums, reorder it such that nums[0] &amp;lt; nums[1] &amp;gt; nu...

2018-03-01 14:17
45
• #### 179. Largest Number

题目 Given a list of non negative integers, arrange them such that they form the largest number. For...

2018-03-02 09:59
57
• #### 164. Maximum Gap

题目 Given an unsorted array, find the maximum difference between the successive elements in its sort...

2018-03-02 17:41
54
• #### 148. Sort List

题目 Sort a linked list in O(n log n) time using constant space complexity. 思路 本题要求将一个链表进行排序，空间复杂度为...

2018-03-04 14:06
76
• #### 147. Insertion Sort List

题目 Sort a linked list using insertion sort. 思路 典型的插入排序，方法直接看代码 代码 /** * Definition for sin...

2018-03-04 14:16
72
• #### 57. Insert Interval

题目 Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if nec...

2018-03-04 14:18
117
• #### 200. Number of Islands

题目 Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is s...

2018-01-29 22:19
58
• #### 721. Accounts Merge

题目 Given a list accounts, each element accounts[i] is a list of strings, where the first element ac...

2018-01-30 11:42
63
• #### 685. Redundant Connection II

题目 In this problem, a rooted tree is a directed graph such that, there is exactly one node (the ro...

2018-01-30 15:23
113
• #### 130. Surrounded Regions

题目 Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'. ...

2018-01-30 16:11
57
• #### 算法归类-union-find（leetcode）

引言 动态连通性问题，我么在面试过程中，经常会遇到，这里做个收集与总结。 典型题目 Longest Consecutive Sequence Friend Circles Couples ...

2018-01-30 16:38
154