摘要: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of 阅读全文
posted @ 2017-03-03 21:48 DevinGu 阅读(392) 评论(0) 推荐(0)
摘要: 最长公共前缀:Write a function to find the longest common prefix string amongst an array of strings. Solution : class Solution {public: string longestCommonP 阅读全文
posted @ 2017-03-03 18:26 DevinGu 阅读(236) 评论(0) 推荐(0)
摘要: Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. Solution: class Solution {public: int roma 阅读全文
posted @ 2017-03-03 16:25 DevinGu 阅读(242) 评论(0) 推荐(0)
摘要: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. Solution: 以3999,为例: class Solution {public 阅读全文
posted @ 2017-03-03 11:26 DevinGu 阅读(271) 评论(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 endpo 阅读全文
posted @ 2017-03-02 22:17 DevinGu 阅读(107) 评论(0) 推荐(0)
摘要: Determine whether an integer is a palindrome. Do this without extra space. Solution: class Solution {public: bool isPalindrome(int x) { if(x<0|| (x!=0 阅读全文
posted @ 2017-03-01 21:09 DevinGu 阅读(152) 评论(0) 推荐(0)
摘要: Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 Note:The input is assumed to be a 32-bit signed integer. Yo 阅读全文
posted @ 2017-03-01 20:53 DevinGu 阅读(190) 评论(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 阅读全文
posted @ 2017-02-28 18:35 DevinGu 阅读(248) 评论(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: Example: class Solution { 阅读全文
posted @ 2017-02-28 18:30 DevinGu 阅读(257) 评论(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 sh 阅读全文
posted @ 2017-02-28 18:09 DevinGu 阅读(149) 评论(0) 推荐(0)