![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
luo-chuang
这个作者很懒,什么都没留下…
展开
-
7. Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321 Have you thought about this?Here are some good questions to ask before coding. Bonus points for you if you ha原创 2016-03-01 14:12:47 · 122 阅读 · 0 评论 -
24. 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.原创 2016-03-02 17:07:56 · 144 阅读 · 0 评论 -
26. 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 place with cons原创 2016-03-02 17:28:45 · 142 阅读 · 0 评论 -
27. 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 length.原创 2016-03-03 09:30:24 · 121 阅读 · 0 评论 -
28. Implement strStr()
Implement strStr(). Returns the index of the first occurrence of needle(关键字) in haystack(字符串), or -1 if needle is not part of haystack.原创 2016-03-03 10:06:39 · 141 阅读 · 0 评论 -
5. 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, and there exists one unique longest palindromic substring.codepublic class LongestPal原创 2016-03-01 13:58:27 · 132 阅读 · 0 评论 -
33. Search in Rotated Sorted Array
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 array return its index原创 2016-03-03 11:36:24 · 153 阅读 · 0 评论 -
33. Search in Rotated Sorted Array
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 not found in原创 2016-03-03 13:42:47 · 128 阅读 · 0 评论 -
35. 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 the array.Here原创 2016-03-03 13:45:44 · 137 阅读 · 0 评论 -
36. 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 ‘.’原创 2016-03-10 14:40:00 · 146 阅读 · 0 评论 -
38. 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.原创 2016-03-10 17:24:16 · 171 阅读 · 0 评论 -
1 Two Sum
Two SumGiven an array of integers, return [indices][5]of the two numbers such that they add up to a specific target. You may assume that each input would have [exactly][5] one solution.[Example : ][5]原创 2016-02-29 15:15:27 · 166 阅读 · 0 评论 -
21. Merge Two Sorted Lists
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-02 16:09:33 · 216 阅读 · 0 评论 -
20. Valid Parentheses
Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.原创 2016-03-02 15:36:05 · 139 阅读 · 0 评论 -
8. String to Integer (atoi)
Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases.N原创 2016-03-01 15:09:43 · 136 阅读 · 0 评论 -
9. Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.hint Could negative integers be palindromes? (ie, -1) noIf you are thinking of converting the integer to string, note the rest原创 2016-03-01 15:43:14 · 142 阅读 · 0 评论 -
11. Container With Most Water
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) and (i, 0). Find two lin原创 2016-03-01 15:50:50 · 124 阅读 · 0 评论 -
13. Roman to Integer
Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.原创 2016-03-01 17:15:46 · 336 阅读 · 0 评论 -
13. Roman to Integer
Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999原创 2016-03-01 17:16:50 · 208 阅读 · 0 评论 -
14. Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.原创 2016-03-02 09:54:42 · 157 阅读 · 0 评论 -
15. 3Sum
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.原创 2016-03-02 11:05:26 · 104 阅读 · 0 评论 -
16. 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 have exactly one solution原创 2016-03-02 13:00:54 · 143 阅读 · 0 评论 -
17. Letter Combinations of a Phone Number
Given a digit string, return all possible letter combinations that the number could represent.原创 2016-03-02 13:06:22 · 112 阅读 · 0 评论 -
18. 4Sum
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 target.原创 2016-03-02 13:32:05 · 164 阅读 · 0 评论 -
19 Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head.原创 2016-03-02 15:21:33 · 132 阅读 · 0 评论 -
3. 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 3. For “原创 2016-03-01 11:01:48 · 147 阅读 · 0 评论