上一页 1 ··· 46 47 48 49 50 51 52 53 54 ··· 80 下一页
摘要: Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algor... 阅读全文
posted @ 2015-03-03 10:21 匡子语 阅读(235) 评论(0) 推荐(0)
摘要: Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.思路:尼玛,各种通不过,开始用纯减法,超时了。然后用递归,溢出了。再然后终于开窍... 阅读全文
posted @ 2015-02-06 22:09 匡子语 阅读(216) 评论(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-02-06 14:40 匡子语 阅读(161) 评论(0) 推荐(0)
摘要: Write a function to find the longest common prefix string amongst an array of strings.思路:找最长公共前缀 常规方法string longestCommonPrefix(vector &strs) { ... 阅读全文
posted @ 2015-02-06 13:37 匡子语 阅读(172) 评论(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-02-05 23:01 匡子语 阅读(197) 评论(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-02-05 20:49 匡子语 阅读(148) 评论(0) 推荐(0)
摘要: Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinki... 阅读全文
posted @ 2015-02-04 21:38 匡子语 阅读(196) 评论(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-02-03 20:05 匡子语 阅读(206) 评论(0) 推荐(0)
摘要: 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-02-03 19:21 匡子语 阅读(175) 评论(0) 推荐(0)
摘要: Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo... 阅读全文
posted @ 2015-02-03 15:26 匡子语 阅读(147) 评论(0) 推荐(0)
上一页 1 ··· 46 47 48 49 50 51 52 53 54 ··· 80 下一页