![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
文章平均质量分 74
china_wanglong
这个作者很懒,什么都没留下…
展开
-
Remove Duplicates from Sorted Array II
原题:Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your function should return length = 5, and A is no原创 2014-08-19 16:13:53 · 407 阅读 · 0 评论 -
Longest Valid Parentheses
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "()",原创 2014-08-30 15:51:25 · 611 阅读 · 0 评论 -
Swap Nodes in Pairs
原题:For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant space. You may not modify the values in the list, only nodes itself can be原创 2014-08-17 22:22:28 · 407 阅读 · 0 评论 -
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 another array, you must do this in p原创 2014-08-19 14:58:23 · 499 阅读 · 0 评论 -
Search in Rotated Sorted Array I II
原题:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the ar原创 2014-09-01 14:36:22 · 647 阅读 · 0 评论 -
Search Insert Position
原题:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in t原创 2014-09-02 18:58:47 · 563 阅读 · 0 评论 -
Search for a Range
原题:Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target is n原创 2014-09-02 18:42:18 · 648 阅读 · 0 评论 -
Sudoku Solver
原题:Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will be only one unique solution.原创 2014-09-27 17:11:41 · 743 阅读 · 0 评论 -
Count and Say
The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read off as原创 2014-10-03 20:27:43 · 719 阅读 · 0 评论 -
Combination Sum
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen from C unlimited numb原创 2014-10-04 16:42:20 · 613 阅读 · 0 评论 -
Merge k Sorted Lists
原题:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.此题可以递归的两两归并,也可以使用youxianj原创 2014-08-15 22:29:40 · 555 阅读 · 0 评论 -
Valid Sudoku
Determine 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 '.'.A partially fille原创 2014-09-12 19:26:41 · 2193 阅读 · 0 评论 -
Reverse Nodes in k-Group
原题:Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left-out nodes in the end should remain原创 2014-08-18 21:24:22 · 456 阅读 · 0 评论 -
Divide Two Integers
Divide two integers without using multiplication, division and mod operator.解答:public int divide(int dividend, int divisor) { boolean negative = (dividend0) || (dividend>0 && divisor<0);原创 2014-08-20 19:02:56 · 515 阅读 · 0 评论 -
Remove Element
原题:Given 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 the new len原创 2014-08-20 16:15:04 · 386 阅读 · 0 评论 -
Longest Substring Without Repeating Characters
原题:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is原创 2014-08-22 10:16:34 · 591 阅读 · 0 评论 -
Substring with Concatenation of All Words
原题:You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and w原创 2014-08-22 14:51:24 · 1333 阅读 · 0 评论 -
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 buttons) is given below.Input原创 2014-08-11 17:03:27 · 9637 阅读 · 2 评论 -
Remove Nth Node From End of List
原题:Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the原创 2014-08-11 20:31:41 · 441 阅读 · 0 评论 -
Valid Parentheses
原题:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are原创 2014-08-12 19:26:11 · 422 阅读 · 0 评论 -
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:"((()))", "(()())", "(())()", "()(()原创 2014-08-15 20:03:22 · 441 阅读 · 0 评论 -
Leetcood解题索引
题目列表:原创 2014-08-22 09:36:27 · 780 阅读 · 0 评论