- 博客(28)
- 收藏
- 关注
原创 [leetcode 28] 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-06 23:04:42 394
原创 [leetcode 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 len
2014-08-06 22:56:57 304
原创 [leetcode 25] Merge k Sorted Lists
题目:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.思路1:代码1:
2014-08-06 15:40:08 321
原创 [leetcode 18] 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-07-08 14:58:06 592
原创 [leetcode 17] 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.Note:
2014-07-08 14:57:45 505
原创 [leetcode 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 would hav
2014-07-08 14:53:36 484
原创 [leetcode 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.Note:Elements in a tripl
2014-07-08 14:40:53 323
原创 [leetcode 14] Longest Common Prefix
题目:Write a function to find the longest common prefix string amongst an array of strings.思路:1.
2014-07-08 14:28:04 465
原创 [leetcode 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.思路:1.题目要求将给定的罗马数字转换为整数,
2014-07-08 14:17:08 628
原创 [leetcode 12] Integer to Roman
题目:Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.思路:1.由于题目说明
2014-07-08 14:08:45 502
原创 [leetcode 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,
2014-07-08 14:03:04 459
原创 [leetcode 9] Palindrome Number
题目:Determine whether an integer is a palindrome. Do this without extra space.思路:
2014-07-04 00:08:43 443
原创 [leetcode 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
2014-07-03 23:23:51 577
原创 [leetcode 7] Reverse Integer
题目:Reverse 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 to ask
2014-07-03 15:24:13 347
原创 [leetcode 6] ZigZag Conversion
题目:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA
2014-07-03 14:35:44 433
原创 [leetcode 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.思路:代码:补充:
2014-07-03 00:46:52 365
原创 [leetcode 4] Add Two Numbers
题目:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it
2014-07-02 16:12:18 635
原创 [leetcode 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
2014-07-02 12:42:30 595
原创 [leetcode 2] Median of Two Sorted Arrays
题目:There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).思路:
2014-07-02 00:34:20 581
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人