码迷,mamicode.com
首页 >  
搜索关键字:valid palindrome    ( 4264个结果
Valid Parentheses
Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must close in the correct ...
分类:其他好文   时间:2014-08-10 15:23:20    阅读次数:215
UVA 401-- Palindromes--串处理
Palindromes  A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string "ABCDEDCBA" is a palindrome because it is the same when t...
分类:其他好文   时间:2014-08-09 21:36:09    阅读次数:344
LeetCode--Valid Number
这道题真心是难度比较大,不是算法难度,是实现难度,各种case都得考虑到。我没有A过,一开始就把.1这种case当做是错误的。导致程序逻辑乱套了。下面是别人的代码: 1 class Solution { 2 public: 3 bool isNumber(const char *s) { 4...
分类:其他好文   时间:2014-08-09 21:21:59    阅读次数:347
[leetcode]Valid Sudoku
Valid SudokuDetermine if a Sudoku is valid, according to:Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are ...
分类:其他好文   时间:2014-08-09 21:20:39    阅读次数:226
hdu4632 Palindrome subsequence
Palindrome subsequenceTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/65535 K (Java/Others)Total Submission(s): 2280Accepted Submission(s):...
分类:其他好文   时间:2014-08-09 21:19:59    阅读次数:274
Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.按照palindrome的定义,负数一定不是palindrome number。而且palindrome number肯定是沿着中轴(可能为一个数或者两...
分类:其他好文   时间:2014-08-09 18:37:28    阅读次数:213
滚动数组~\(≧▽≦)/~
今天第一次用了滚动数组,缘由要从一道题说起:POJ 1159 Palindrome 题意:给你一个字符串,求对字符串最少添加几个字符可变为回文串。 分析: 简单做法是直接对它和它的逆序串求最长公共子序列长度len。n-len即为所求。至于为什么,小盆友们可以自己模拟一下下。O(∩_∩)O~因为这不是...
分类:其他好文   时间:2014-08-09 11:29:07    阅读次数:286
POJ 3280 Cheapest Palindrome DP题解
看到Palindrome的题目,首先想到的应该是中心问题,然后从中心出发,思考如何解决。 DP问题一般是从更加小的问题转化到更加大的问题,然后是从地往上 bottom up地计算答案的。 能得出状态转移方程就好办了,本题的状态转移方程是: if (cowID[i] == cow{j]) tbl[id][i] = tbl[id][i+1];//相等的时候无需改动 else tbl[id][i...
分类:其他好文   时间:2014-08-09 00:14:16    阅读次数:344
Evaluate Reverse Polish Notation
Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another ex...
分类:其他好文   时间:2014-08-08 23:49:56    阅读次数:314
HDU4915:Parenthese sequence(贪心)
Problem Description bobo found an ancient string. The string contains only three charaters -- "(", ")" and "?". bobo would like to replace each "?" with "(" or ")" so that the string is valid (d...
分类:其他好文   时间:2014-08-08 18:15:06    阅读次数:273
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!