09 2015 档案

Scramble String
摘要:Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation... 阅读全文
posted @ 2015-09-17 23:36 怕忘记 阅读(115) 评论(0) 推荐(0)
Partition List
摘要:Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the origi... 阅读全文
posted @ 2015-09-17 23:34 怕忘记 阅读(120) 评论(0) 推荐(0)
Maximal Rectangle
摘要:Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.int maximalRectangle(vector>& mat... 阅读全文
posted @ 2015-09-17 23:33 怕忘记 阅读(131) 评论(0) 推荐(0)
Largest Rectangle in Histogram
摘要:Givennnon-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histog... 阅读全文
posted @ 2015-09-17 23:22 怕忘记 阅读(119) 评论(0) 推荐(0)
Implement strStr()
摘要:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Update (2014-11-02):The si... 阅读全文
posted @ 2015-09-17 22:24 怕忘记 阅读(118) 评论(0) 推荐(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 mat... 阅读全文
posted @ 2015-09-12 14:32 怕忘记 阅读(116) 评论(0) 推荐(0)
Remove Duplicates from Sorted Array
摘要:Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a... 阅读全文
posted @ 2015-09-12 13:45 怕忘记 阅读(148) 评论(0) 推荐(0)
Reverse Nodes in k-Group
摘要:Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o... 阅读全文
posted @ 2015-09-10 15:18 怕忘记 阅读(196) 评论(0) 推荐(0)
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. Your a 阅读全文
posted @ 2015-09-10 15:17 怕忘记 阅读(132) 评论(0) 推荐(0)
Generate Parentheses
摘要:Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))... 阅读全文
posted @ 2015-09-10 15:16 怕忘记 阅读(139) 评论(0) 推荐(0)
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 1 /** 2 ... 阅读全文
posted @ 2015-09-10 15:15 怕忘记 阅读(116) 评论(0) 推荐(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 ... 阅读全文
posted @ 2015-09-10 15:14 怕忘记 阅读(116) 评论(0) 推荐(0)
Remove Nth Node From End of List
摘要:Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After re... 阅读全文
posted @ 2015-09-10 15:13 怕忘记 阅读(125) 评论(0) 推荐(0)
4Sum
摘要:Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum of ... 阅读全文
posted @ 2015-09-10 15:12 怕忘记 阅读(117) 评论(0) 推荐(0)
3Sum Closest
摘要:Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. You m... 阅读全文
posted @ 2015-09-10 15:11 怕忘记 阅读(117) 评论(0) 推荐(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 telephon... 阅读全文
posted @ 2015-09-10 15:11 怕忘记 阅读(131) 评论(0) 推荐(0)
3Sum
摘要:Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Elemen... 阅读全文
posted @ 2015-09-10 15:07 怕忘记 阅读(152) 评论(0) 推荐(0)
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 inline int c2n(char c) { 2 switc... 阅读全文
posted @ 2015-09-10 15:05 怕忘记 阅读(125) 评论(0) 推荐(0)
Longest Common Prefix
摘要:Write a function to find the longest common prefix string amongst an array of strings. 1 string longestCommonPrefix(vector& strs) { 2 int i=0,... 阅读全文
posted @ 2015-09-10 15:05 怕忘记 阅读(173) 评论(0) 推荐(0)
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 string intToRoman(int num) { 2 ... 阅读全文
posted @ 2015-09-10 15:04 怕忘记 阅读(123) 评论(0) 推荐(0)
Container With Most Water
摘要:Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of ... 阅读全文
posted @ 2015-09-10 15:03 怕忘记 阅读(131) 评论(0) 推荐(0)
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 fo... 阅读全文
posted @ 2015-09-10 14:48 怕忘记 阅读(125) 评论(0) 推荐(0)
Palindrome Number
摘要:Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (i... 阅读全文
posted @ 2015-09-07 22:20 怕忘记 阅读(113) 评论(0) 推荐(0)
String to Integer (atoi)
摘要:Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, please do not see below and ... 阅读全文
posted @ 2015-09-07 22:19 怕忘记 阅读(120) 评论(0) 推荐(0)
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 som... 阅读全文
posted @ 2015-09-07 22:18 怕忘记 阅读(155) 评论(0) 推荐(0)
Longest Palindromic Substring
摘要:Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa... 阅读全文
posted @ 2015-09-07 22:16 怕忘记 阅读(155) 评论(0) 推荐(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 fo... 阅读全文
posted @ 2015-09-07 22:14 怕忘记 阅读(143) 评论(0) 推荐(0)
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 ... 阅读全文
posted @ 2015-09-07 19:46 怕忘记 阅读(133) 评论(0) 推荐(0)
Two Sum
摘要:Given 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 nu... 阅读全文
posted @ 2015-09-07 19:44 怕忘记 阅读(114) 评论(0) 推荐(0)