2015年9月10日

摘要: 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 怕忘记 阅读(187) 评论(0) 推荐(0) 编辑
 
摘要: 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 怕忘记 阅读(124) 评论(0) 推荐(0) 编辑
 
摘要: 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 怕忘记 阅读(129) 评论(0) 推荐(0) 编辑
 
摘要: 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 怕忘记 阅读(110) 评论(0) 推荐(0) 编辑
 
摘要: 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 怕忘记 阅读(107) 评论(0) 推荐(0) 编辑
 
摘要: 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 怕忘记 阅读(116) 评论(0) 推荐(0) 编辑
 
摘要: 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 怕忘记 阅读(109) 评论(0) 推荐(0) 编辑
 
摘要: 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 怕忘记 阅读(109) 评论(0) 推荐(0) 编辑
 
摘要: 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 怕忘记 阅读(122) 评论(0) 推荐(0) 编辑
 
摘要: 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 怕忘记 阅读(142) 评论(0) 推荐(0) 编辑
 
摘要: 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 怕忘记 阅读(118) 评论(0) 推荐(0) 编辑
 
摘要: 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 怕忘记 阅读(166) 评论(0) 推荐(0) 编辑
 
摘要: 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 怕忘记 阅读(115) 评论(0) 推荐(0) 编辑
 
摘要: 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 怕忘记 阅读(125) 评论(0) 推荐(0) 编辑
 
摘要: 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 怕忘记 阅读(116) 评论(0) 推荐(0) 编辑