【题目】Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: ...
分类:
其他好文 时间:
2015-06-04 17:02:05
阅读次数:
105
基本思路:把 int 转换成string 借用stringstream 时间复杂度O(n) 1 class Solution { 2 public: 3 public: 4 bool isPalindrome(int x) { 5 6 stringstream ss; ...
分类:
其他好文 时间:
2015-06-03 23:22:46
阅读次数:
151
判断回文,简单的入栈出栈判断,其他的就是简单的回溯了。class Solution {private: vector> res; vector tempRes;public: bool isValid(string str) { stack stk; ...
分类:
其他好文 时间:
2015-06-02 21:26:50
阅读次数:
162
Determine whether an integer is a palindrome. Do this without extra space.
本题是判断一个数是否是回文数。
代码如下:
bool isPalindrome(int x) {
int max = x;
int min = 0;
while(max >0){
...
分类:
其他好文 时间:
2015-06-02 09:26:12
阅读次数:
102
Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ...
分类:
编程语言 时间:
2015-06-01 22:02:43
阅读次数:
135
题目:Given a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ...
分类:
其他好文 时间:
2015-06-01 20:16:51
阅读次数:
103
Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example,...
分类:
编程语言 时间:
2015-06-01 20:08:32
阅读次数:
138
Description
The “U.S. Robots” HQ has just received a rather alarming anonymous letter. It states that the agent from the competing «Robots Unlimited» has infiltrated into “U.S. Robotics”. «U.S. R...
分类:
编程语言 时间:
2015-05-31 01:24:51
阅读次数:
160
Palindrome NumberDetermine whether an integer is a palindrome. Do this without extra space.public class Solution { public boolean isPalindrome(int ...
分类:
其他好文 时间:
2015-05-29 07:26:14
阅读次数:
136
Palindrome Number
题目:
Determine whether an integer is a palindrome. Do this without extra space. 题意:
判断一个整数是否是回文的,要求不使用额外的空间 思路:
简单起见我用的python,先判断是否为0,或者负数,若不是则转化为字符串,然后利用切片截取两段,反转其中一个比较是...
分类:
其他好文 时间:
2015-05-28 09:37:01
阅读次数:
125