11 2016 档案

摘要:Given n non-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.For example, Given [0,1,0,2,1,0,1,3,2,1,2,1], retu... 阅读全文
posted @ 2016-11-30 14:34 copperface 阅读(267) 评论(0) 推荐(0)
摘要: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, 0). Find two ... 阅读全文
posted @ 2016-11-30 11:00 copperface 阅读(193) 评论(0) 推荐(0)
摘要:Implement regular expression matching with support for '.' and '*'.'.' Matches any single character. '*' Matches zero or more of the preceding element. The matching should cover the entire input stri... 阅读全文
posted @ 2016-11-29 21:21 copperface 阅读(236) 评论(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 thinking of converting the integer to string, note the r... 阅读全文
posted @ 2016-11-29 12:58 copperface 阅读(206) 评论(0) 推荐(0)
摘要: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 input cases.... 阅读全文
posted @ 2016-11-29 11:13 copperface 阅读(190) 评论(0) 推荐(0)
摘要: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 before coding. Bonus poi... 阅读全文
posted @ 2016-11-28 20:17 copperface 阅读(130) 评论(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 for better legibility)P A H N A P L S I I G ... 阅读全文
posted @ 2016-11-28 19:49 copperface 阅读(404) 评论(0) 推荐(0)
摘要:Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.寻找最长回文子串Example:Input: "babad" Output: "bab" Note: "aba" is also a valid answer. Ex... 阅读全文
posted @ 2016-11-27 16:05 copperface 阅读(361) 评论(0) 推荐(0)
摘要:There are two sorted arrays nums1 and nums2 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)).Example 1:nums1 = [1, 3] nums2... 阅读全文
posted @ 2016-11-26 13:31 copperface 阅读(274) 评论(0) 推荐(0)
摘要: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 as a link... 阅读全文
posted @ 2016-11-26 13:30 copperface 阅读(206) 评论(0) 推荐(0)
摘要:Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "b", with the l... 阅读全文
posted @ 2016-11-26 13:30 copperface 阅读(182) 评论(0) 推荐(0)
摘要:Given an array of integers, return indices of the two numbers such that they add up to a specific target.从给定序列中找出和为指定数字的两个数字的下标You may assume that each input would have exactly one solution.假设每个输入只有一个... 阅读全文
posted @ 2016-11-26 13:29 copperface 阅读(572) 评论(0) 推荐(0)