
LeetCode
文章平均质量分 52
S1mplify
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
[LeetCode]Generate Parentheses题解
Generate Parentheses: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: [ “((()))”, “(()())”原创 2017-09-17 21:03:06 · 203 阅读 · 0 评论 -
[LeetCode]Maximum Subarray题解
[*Maximum Subarray*](https://leetcode.com/problems/maximum-subarray/description/): >Find the contiguous subarray within an array (containing at least one number) which has the largest sum. >For example, given原创 2017-11-22 16:43:44 · 214 阅读 · 0 评论 -
[LeetCode]Reverse Words in a String
Given an input string, reverse the string word by word. For example, Given s = “the sky is blue”, return “blue is sky the”.原创 2017-11-07 23:59:35 · 150 阅读 · 0 评论 -
[LeetCode]Length of Last Word
Length of Last Word: Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in the string. If the last word does not exist, return原创 2017-12-16 23:59:37 · 165 阅读 · 0 评论 -
[LeetCode]Longest Palindromic Substring题解(动态规划)
Longest Palindromic Substring: Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Input: “babad” Output: “bab” ...原创 2017-12-27 15:50:38 · 336 阅读 · 0 评论 -
[LeetCode]Letter Combinations of a Phone Number题解
Letter Combinations of a Phone Number: Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone...原创 2017-12-26 18:34:05 · 305 阅读 · 0 评论 -
[LeetCode]Maximum Length of Repeated Subarray
Maximum Length of Repeated Subarray: Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays. Example 1: Input: A: [1,2,3,2,1] B: [3,2,1,4原创 2017-11-23 20:19:27 · 223 阅读 · 0 评论 -
[LeetCode]Delete and Earn题解(动态规划)
Delete and Earn Given an array nums of integers, you can perform operations on the array. In each operation, you pick any nums[i] and delete it to earn nums[i] points. After, you must delete eve原创 2017-12-28 20:36:47 · 278 阅读 · 0 评论 -
[LeetCode]Combination Sum题解(DFS)
Combination Sum Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeated n...原创 2018-03-23 11:35:47 · 316 阅读 · 0 评论 -
[LeetCode]Flatten Binary Tree to Linked List题解(二叉树)
Flatten Binary Tree to Linked List: Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / \ 2 5 / \ \ 3 4 6 The flattened tree sh...原创 2018-04-08 11:38:43 · 176 阅读 · 0 评论 -
[LeetCode]Find Bottom Left Tree Value
Find Pivot: Given an array of integers nums, write a method that returns the “pivot” index of this array. We define the pivot index as the index where the sum of the numbers to the left of the i原创 2017-12-02 14:42:18 · 206 阅读 · 0 评论 -
[LeetCode]Find Pivot
Find Pivot: Given an array of integers nums, write a method that returns the “pivot” index of this array. We define the pivot index as the index where the sum of the numbers to the left of the i原创 2017-12-09 10:48:31 · 276 阅读 · 1 评论 -
[LeetCode]Remove Duplicates from Sorted Array题解
Remove Duplicates from Sorted Array: Given 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 for anoth原创 2017-09-24 23:13:01 · 185 阅读 · 0 评论 -
[LeetCode]Longest Substring Without Repeating Characters题解
Longest Substring Without Repeating Characters: Given a string, find the length of the longest substring without repeating characters. Examples: Given “abcabcbb”, the answer is “abc”, which原创 2017-09-11 21:40:28 · 194 阅读 · 0 评论 -
[LeetCode] Binary Tree Postorder题解
Binary Tree Postorder Given a binary tree, return the postorder traversal of its nodes’ values. For example: Given binary tree {1,#,2,3},return [3,2,1]. Note: Recursive solution is trivi原创 2017-09-10 15:21:07 · 254 阅读 · 0 评论 -
[LeetCode] Add Two Numbers题解
Add Two Numbers: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two nu原创 2017-09-10 13:41:17 · 174 阅读 · 0 评论 -
[LeetCode] Three Sum题解
Three Sum: 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 solution set must n原创 2017-09-07 13:49:47 · 471 阅读 · 0 评论 -
[LeetCode]Swap Nodes in Pairs题解
Swap Nodes in Pairs: Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm shoul原创 2017-10-09 23:43:57 · 198 阅读 · 0 评论 -
[LeetCode] Remove Element题解
Remove Element: Given an array and a value, 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 in place with c原创 2017-10-03 20:07:37 · 193 阅读 · 0 评论 -
[LeetCode]Implement strStr()
Implement strStr(): Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 执行两次遍历即可。算法复杂度在最坏的情况下不会超过O(mn)。class Solution {原创 2017-10-31 21:45:19 · 168 阅读 · 0 评论 -
[LeetCode]Symmetric Tree
Symmetric Tree: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 1 / \ 2原创 2017-10-24 12:48:18 · 247 阅读 · 0 评论 -
[LeetCode]3Sum Closest题解
3sum Closest: 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 each input wou原创 2017-10-16 17:08:24 · 245 阅读 · 0 评论 -
[LeetCode] Next Permutation(一种巧妙的解题方法)
Next Permutation Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it ...原创 2018-04-04 21:40:42 · 349 阅读 · 0 评论