leetcode
Gao__Xiong
这个作者很懒,什么都没留下…
展开
-
5. Longest Palindromic Substring
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.Example: In原创 2016-12-04 21:36:20 · 319 阅读 · 0 评论 -
7. Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321 click to show spoilers. 解决代码:class Solution {public: int reverse(int x) { long long temp = abs(原创 2016-12-04 21:38:21 · 291 阅读 · 0 评论 -
134. Gas Station
There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to its ne原创 2016-12-04 21:46:04 · 419 阅读 · 0 评论 -
9. Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints: Could negative integers be palindromes? (ie, -1)If you are thinking of converting the inte原创 2016-12-04 21:41:29 · 342 阅读 · 0 评论 -
8. String to Integer (atoi)
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.N原创 2016-12-04 21:40:03 · 348 阅读 · 0 评论 -
11. Container With Most Water
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 lin原创 2016-12-04 22:14:00 · 525 阅读 · 0 评论