![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Leetcode
文章平均质量分 77
樱子飞飞
这个作者很懒,什么都没留下…
展开
-
Letter Combinations of a Phone Number
Letter Combinations of a Phone NumberGiven a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone but原创 2014-09-17 08:57:37 · 371 阅读 · 0 评论 -
Combinations
CombinationsGiven two integers n and k, return all possible combinations ofk numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2],原创 2014-09-11 11:00:46 · 299 阅读 · 0 评论 -
Copy List with Random Pointer
Copy List with Random PointerA linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list.原创 2014-09-11 10:45:10 · 270 阅读 · 0 评论 -
各种List Sort
排序算法,原创 2014-09-11 09:50:45 · 322 阅读 · 0 评论 -
Recover Binary Search Tree
Recover Binary Search TreeTwo elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is pretty strai原创 2014-08-28 16:34:24 · 228 阅读 · 0 评论 -
Reverse Words in a String
Reverse Words in a StringTotal Accepted: 31611 Total Submissions: 224230 Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sk原创 2014-09-11 14:38:38 · 298 阅读 · 0 评论 -
Remove Element
Remove ElementGiven an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you leave beyond th原创 2014-09-11 10:56:02 · 306 阅读 · 0 评论 -
Convert Sorted Array(List) to Binary Search Tree
Convert Sorted Array to Binary Search TreeGiven an array where elements are sorted in ascending order, convert it to a height balanced BST.题意:用一个有序数组原创 2014-08-28 16:27:40 · 412 阅读 · 0 评论 -
Best Time to Buy and Sell Stock I II III
Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),原创 2014-08-15 10:12:17 · 288 阅读 · 0 评论 -
Unique Binary Search Trees I & II
Unique Binary Search TreesGiven n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1原创 2014-08-28 17:02:22 · 266 阅读 · 0 评论 -
Word Break
Word BreakGiven a string s and a dictionary of words dict, determine ifs can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",原创 2014-09-11 11:09:18 · 452 阅读 · 0 评论 -
Evaluate Reverse Polish Notation
Evaluate Reverse Polish NotationEvaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression原创 2014-09-11 14:48:48 · 261 阅读 · 0 评论 -
Swap Nodes in Pairs
Swap Nodes in PairsGiven 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 should use o原创 2014-09-17 08:49:38 · 293 阅读 · 0 评论 -
2sum 3sum 4sum 各种sum
Two SumGiven an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the原创 2014-09-02 21:04:41 · 443 阅读 · 0 评论 -
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 6The flattened tree should look like: 1 \原创 2014-08-31 19:41:13 · 237 阅读 · 0 评论 -
Validate Binary Search Tree
Validate Binary Search TreeGiven a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with k原创 2014-08-28 09:42:22 · 259 阅读 · 0 评论 -
Substring with Concatenation of All Words
https://oj.leetcode.com/problems/substring-with-concatenation-of-all-words/原创 2014-08-16 22:10:11 · 270 阅读 · 0 评论 -
LastNode of 完全二叉树
题目:求完全二叉树中,最后原创 2014-09-12 11:15:54 · 465 阅读 · 0 评论 -
Longest Substring Without Repeating Characters
https://oj.leetcode.com/problems/longest-substring-without-repeating-characters/Given a string, find the length of the longest substring without repeating characters. For example, the longest原创 2014-08-16 21:55:44 · 281 阅读 · 0 评论 -
String to Integer (atoi)
https://oj.leetcode.com/problems/string-to-integer-atoi/原创 2014-08-16 21:47:40 · 261 阅读 · 0 评论 -
Rotate List
Rotate ListGiven a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.原创 2014-09-11 10:34:23 · 250 阅读 · 0 评论 -
Remove Duplicates from Sorted List I II
Remove Duplicates from Sorted List My SubmissionsGiven a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given原创 2014-08-25 20:08:23 · 321 阅读 · 0 评论 -
Anagrams
AnagramsGiven an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.题目:理解anagrams的意思,原创 2014-09-09 14:40:30 · 418 阅读 · 0 评论 -
Add Binary
Add BinaryGiven two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".原创 2014-09-09 15:09:06 · 325 阅读 · 0 评论 -
Merge/Insert interval 区间合并
Merge问题原创 2014-08-15 15:01:07 · 384 阅读 · 0 评论 -
Implement strStr()
Implement strStr()Total Accepted: 18315 Total Submissions: 83921 Implement strStr().Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack原创 2014-09-06 20:28:52 · 246 阅读 · 0 评论 -
Palindrome Number
Palindrome NumberDetermine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (ie, -1)If you are th原创 2014-09-18 10:29:43 · 286 阅读 · 0 评论 -
Maximum Subarray
Maximum SubarrayFind the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1,−3,4,−1,2,1,−5,4],the contiguous su原创 2014-09-18 11:11:21 · 311 阅读 · 0 评论 -
Reverse Integer
Reverse IntegerReverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thought about this?Here are some good questions原创 2014-09-18 10:17:41 · 303 阅读 · 0 评论 -
Longest Consecutive Sequence
Longest Consecutive SequenceGiven an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecuti原创 2014-09-18 11:21:42 · 289 阅读 · 0 评论 -
Gas Station
Gas StationThere are N gas stations along a circular route, where the amount of gas at stationi is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from原创 2014-09-18 10:37:37 · 632 阅读 · 0 评论 -
各种Parentheses
Valid ParenthesesGiven a string containing just the characters '(', ')','{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "原创 2014-09-04 22:11:05 · 312 阅读 · 0 评论 -
Single Number II
Single Number II My SubmissionsGiven an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime compl原创 2014-08-21 09:50:28 · 310 阅读 · 0 评论 -
Scramble String
Scramble StringGiven a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = "great": gre原创 2014-09-19 19:22:05 · 410 阅读 · 0 评论 -
Binary Tree Maximum Path Sum
Binary Tree Maximum Path Sum My SubmissionsGiven a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree,原创 2014-08-26 21:37:18 · 381 阅读 · 0 评论 -
Permutation Sequence
Permutation Sequence The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie, for n =原创 2014-08-23 19:42:25 · 344 阅读 · 0 评论 -
Sqrt(x)
Sqrt(x)Implement int sqrt(int x).Compute and return the square root of x.题目:求平凡原创 2014-09-08 09:55:24 · 1447 阅读 · 0 评论 -
Word Ladder
Word LadderGiven two words (start and end), and a dictionary, find the length of shortest transformation sequence fromstart to end, such that:Only one letter can be changed at a timeEach i原创 2014-09-08 09:30:37 · 391 阅读 · 0 评论 -
Climbing Stairs
Climbing StairsYou are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?题目:爬楼梯,每次原创 2014-09-07 16:34:59 · 259 阅读 · 0 评论 -
Valid Palindrome
Valid PalindromeGiven a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."r原创 2014-09-07 16:58:06 · 231 阅读 · 0 评论