02 2015 档案

摘要:Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.思路:尼玛,各种通不过,开始用纯减法,超时了。然后用递归,溢出了。再然后终于开窍... 阅读全文
posted @ 2015-02-06 22:09 匡子语 阅读(212) 评论(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 匡子语 阅读(152) 评论(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 匡子语 阅读(167) 评论(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 匡子语 阅读(194) 评论(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 匡子语 阅读(145) 评论(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 匡子语 阅读(188) 评论(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 匡子语 阅读(204) 评论(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 匡子语 阅读(171) 评论(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 匡子语 阅读(142) 评论(0) 推荐(0) 编辑
摘要:Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a... 阅读全文
posted @ 2015-02-02 21:46 匡子语 阅读(141) 评论(0) 推荐(0) 编辑
摘要:Given two words (startandend), and a dictionary, find the length of shortest transformation sequence fromstarttoend, such that:Only one letter can be ... 阅读全文
posted @ 2015-02-02 21:21 匡子语 阅读(200) 评论(0) 推荐(0) 编辑
摘要:Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.For exampl... 阅读全文
posted @ 2015-02-02 16:35 匡子语 阅读(168) 评论(0) 推荐(0) 编辑
摘要:Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.Fo... 阅读全文
posted @ 2015-02-02 15:42 匡子语 阅读(204) 评论(0) 推荐(0) 编辑