摘要: 题目: 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 e 阅读全文
posted @ 2016-03-19 21:20 gavinXing 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 题目:Determine whether an integer is a palindrome. Do this without extra space.   思路: 1.利用leetcode #7 的reverse(int x) 2.详见code   代码:思路2 C++  参考: https:/ 阅读全文
posted @ 2016-03-15 20:41 gavinXing 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 题目:https://leetcode.com/problems/string-to-integer-atoi/ Implement atoi to convert a string to an integer. 思路: 把情况搞清楚就好了。 代码:C++: int myAtoi(string st 阅读全文
posted @ 2016-03-10 20:23 gavinXing 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 题目:https://leetcode.com/problems/reverse-integer/ Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 思路: 这道题不难 阅读全文
posted @ 2016-03-10 12:06 gavinXing 阅读(109) 评论(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 @ 2016-03-10 12:01 gavinXing 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longes 阅读全文
posted @ 2016-02-15 21:21 gavinXing 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letter 阅读全文
posted @ 2016-02-10 21:43 gavinXing 阅读(653) 评论(0) 推荐(0) 编辑
摘要: 题目: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stoppin 阅读全文
posted @ 2016-02-03 15:34 gavinXing 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 题目: Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = "anagram", t = "nagaram", return true.s = "rat", 阅读全文
posted @ 2016-02-03 12:54 gavinXing 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators 阅读全文
posted @ 2016-02-02 18:21 gavinXing 阅读(173) 评论(0) 推荐(0) 编辑