
leetcode
文章平均质量分 62
csdn_lisword
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
leetcode 97. Interleaving String
1. 题目描述 Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. Fo原创 2016-01-04 00:23:55 · 322 阅读 · 0 评论 -
leetcode 33. Search in Rotated Sorted Array
1.题目 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 g原创 2016-04-12 15:30:27 · 282 阅读 · 0 评论 -
leetcode 32. Longest Valid Parentheses
1.题目 Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. For "(()原创 2016-04-12 14:41:29 · 253 阅读 · 0 评论 -
leetcode 31. Next Permutation
1.题目 Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not pos原创 2016-04-12 13:37:28 · 279 阅读 · 0 评论 -
leetcode 26. Remove Duplicates from Sorted Array
1.题目 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原创 2016-03-25 13:33:54 · 240 阅读 · 0 评论 -
leetcode 25. Reverse Nodes in k-Group
1.题目 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 n原创 2016-03-25 13:15:52 · 245 阅读 · 0 评论 -
leetcode 24. Swap Nodes in Pairs
1.题目 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 algor原创 2016-03-25 12:10:00 · 218 阅读 · 0 评论 -
leetcode 23. Merge k Sorted Lists
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 将k个有序链表合并成一个有序链表。 2.思路 第一种解法,设置两个指针p1,p2分别指向两个链原创 2016-03-25 11:40:18 · 444 阅读 · 0 评论 -
leetcode 22. Generate Parentheses
1.题目 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: "((()))原创 2016-03-24 21:27:29 · 263 阅读 · 0 评论 -
leetcode 34. Search for a Range
1.题目 Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity mu原创 2016-04-12 15:44:50 · 295 阅读 · 0 评论 -
leetcode 35. Search Insert Position
1.题目 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 wer原创 2016-04-12 15:49:04 · 304 阅读 · 0 评论 -
leetcode 40. Combination Sum II
1.题目 Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbe原创 2016-04-13 16:38:20 · 364 阅读 · 0 评论 -
leetcode 39. Combination Sum
1.题目 Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to原创 2016-04-13 16:32:51 · 349 阅读 · 0 评论 -
leetcode 38. Count and Say
1.题目 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" o原创 2016-04-13 15:41:50 · 260 阅读 · 0 评论 -
leetcode 37. Sudoku Solver
1.题目 Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated by the character '.'. You may assume原创 2016-04-13 15:15:13 · 331 阅读 · 0 评论 -
leetcode 36. Valid Sudoku
1.题目 Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be partially filled, where emp原创 2016-04-13 14:59:40 · 273 阅读 · 0 评论 -
leetcode 29. Divide Two Integers
1.题目 Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. 在不用乘号,除号,以及取余的情况下,计算两个原创 2016-03-28 11:30:19 · 359 阅读 · 0 评论 -
leetcode 28. Implement strStr()
1.题目 Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 给你两个字符串haystack和原创 2016-03-28 10:46:28 · 276 阅读 · 0 评论 -
leetcode 27. Remove Element
1.题目 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原创 2016-03-27 10:09:15 · 347 阅读 · 0 评论 -
Leetcode 11. Container With Most Water
1.题目 Given 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 line i is at (i, ai) a原创 2016-03-14 12:33:13 · 333 阅读 · 0 评论 -
leetcode 10. Regular Expression Matching
1.题目 Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or more of the preceding element. The matching should cover the ent原创 2016-03-14 11:30:20 · 219 阅读 · 0 评论 -
leetcode 17. Letter Combinations of a Phone Number
1.题目 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 be原创 2016-03-17 09:27:00 · 290 阅读 · 0 评论 -
leetcode 16. 3Sum Closest
1.题目 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原创 2016-03-17 09:12:18 · 266 阅读 · 0 评论 -
leetcode 15. 3Sum
1.题目 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: Elements原创 2016-03-16 17:20:51 · 306 阅读 · 0 评论 -
leetcode 14. Longest Common Prefix
1.题目 Write a function to find the longest common prefix string amongst an array of strings. 找出所有字符串的最长公共前缀。 2.思路 先找前两个字符串的最长公共前缀,然后后面的字符串和这个公共前缀逐一比较,不断更新这个前缀即可(这个前缀只可能越来原创 2016-03-16 16:40:59 · 240 阅读 · 0 评论 -
leetcode 12. Integer to Roman
1.题目 Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 将整数(1-3999)转换成罗马数字。 2.思路 只要知道罗马数字的是怎么表示的: 1~9: {"I",原创 2016-03-16 16:18:55 · 206 阅读 · 0 评论 -
leetcode 3. Longest Substring Without Repeating Characters
1.题目描述 Total Accepted: 117220 Total Submissions: 555265 Difficulty: Medium原创 2016-01-07 20:44:28 · 270 阅读 · 0 评论 -
leetcode 2. Add Two Numbers
1.题目描述 Total Accepted: 111540 Total Submissions: 513925 Difficulty: Medium原创 2016-01-07 20:14:57 · 467 阅读 · 0 评论 -
leetcode 1. Two Sum
1.题目描述 Total Accepted: 171781 Total Submissions: 850971 Difficulty: Medium原创 2016-01-07 16:27:14 · 290 阅读 · 0 评论 -
leetcode 18.4Sum
1.题目 Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of t原创 2016-03-17 19:37:48 · 423 阅读 · 0 评论 -
leetcode 19. Remove Nth Node From End of List
1.题目 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 t原创 2016-03-17 19:46:33 · 274 阅读 · 0 评论 -
leetcode 9. Palindrome Number
1.题目 Determine whether an integer is a palindrome. Do this without extra space. 判断一个整数是否是回文数。 2.思路 此题so easy,负数不是回文数。直接贴代码: class Solution { public: bool isPalindro原创 2016-03-12 18:28:18 · 337 阅读 · 0 评论 -
leetcode 8. String to Integer (atoi)
1.题目 Implement atoi to convert a string to an integer. 将一个字符串转换为整型。 2.思路 atoi是面试官经常会问到的题目,主要是要考虑各种情形,那么一般的atoi有哪些要求呢? 1. 对于输入字符串str,前面的空格忽略不计,从第一个非空字符串开始计数,第一个非空字符串只能原创 2016-03-12 18:18:14 · 408 阅读 · 0 评论 -
leetcode 6. ZigZag Conversion
1.题目 Total Accepted: 79300 Total Submissions: 337482 Difficulty: Easy The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want原创 2016-03-12 10:26:30 · 408 阅读 · 0 评论 -
leetcode 7. Reverse Integer
1.题目 Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 反转一个整数。 2.思路 此题无难度,注意int的界限问题。 int reverse(int x) { if(x==0) return 0原创 2016-03-12 10:36:08 · 306 阅读 · 0 评论 -
leetcode 5. Longest Palindromic Substring
1.题目 Total Accepted: 98199 Total Submissions: 432790 Difficulty: Medium Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is原创 2016-03-11 21:11:15 · 351 阅读 · 0 评论 -
leetcode 4. Median of Two Sorted Arrays
1.题目 Total Accepted: 85951 Total Submissions: 470608 Difficulty: Hard There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arr原创 2016-03-11 11:30:03 · 338 阅读 · 0 评论 -
leetcode 21. Merge Two Sorted Lists
1.题目 Merge 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. 将两个有序链表合并成一个有序链原创 2016-03-18 22:55:48 · 314 阅读 · 0 评论 -
leetcode 20. Valid Parentheses
1.题目 Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the correct order原创 2016-03-17 19:50:08 · 251 阅读 · 0 评论 -
leetcode 41. First Missing Positive
1.题目 Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbe转载 2016-04-15 15:06:15 · 336 阅读 · 0 评论