写了一个丑陋无比的解决方法,虽然知道怎么能够在让代码精简些,但是今晚太累人,改天再改。public class Solution { public boolean isValid(String s) { if(s.length()%2==1){ return...
分类:
其他好文 时间:
2014-10-30 00:01:21
阅读次数:
389
这道题考查对二维数组的处理,哈希表。
1.最自然的方法就是分别看每个数是否符合三个规则,所以就需要相应的数据结构来
记录这些信息,判定是否存在,显然最先想到用哈希表。
2.学会把问题抽象成一个个的子问题。
3.在索引的构建上下工夫。
4.底层数组如何对应的细节没有那么重要,重要的是构成了问题的全集。
代码:
附图:一趟遍历时根据i,j,对应到具体的grid,这里的构造模式有多种(??...
分类:
其他好文 时间:
2014-10-29 22:20:29
阅读次数:
212
Valid NumberValidate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intend...
分类:
其他好文 时间:
2014-10-29 21:04:03
阅读次数:
166
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Pana...
分类:
其他好文 时间:
2014-10-29 12:44:21
阅读次数:
171
1, 堆栈的应用,算是很经典的题目2,记得给stack 设置类型,否则就是objectpublic class Solution { public boolean isValid(String s) { if(s.length()==0||s.length()==1){ ...
分类:
其他好文 时间:
2014-10-29 07:03:16
阅读次数:
192
问题描述:
Validate if a given string is numeric.
Some examples:
"0" => true
" 0.1 " => true
"abc" => false
"1 a" => false
"2e10" => true
Note: It is intended for the problem statement to be am...
分类:
其他好文 时间:
2014-10-28 21:52:13
阅读次数:
192
Add Instruction Node Every valid XML must contain processing instruction. XML is widely used for HTML, SVG, XLS etc. So make sure your XML file has valid instruction of its type and encoding. The f...
分类:
其他好文 时间:
2014-10-27 21:27:17
阅读次数:
155
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.//数字或字母For example,"A man, a plan, a cana...
分类:
其他好文 时间:
2014-10-27 20:55:25
阅读次数:
178
<?php
define ( "TOKEN", "tony" );
if (! isset ( $_GET ["echostr"] )) {
// 调用响应消息函数
responseMsg ();
} else {
// 实现网址接入,调用验证消息函数
valid ();
}
/*
* 验证消息函数
*/
function valid() {
if (checkSignature ...
分类:
微信 时间:
2014-10-27 14:26:09
阅读次数:
345
典型的用栈(stack)结构解决问题的例子class Solution: def isPair(self,s1,s2): if (s1=='(' and s2==')')or (s2=='(' and s1==')'): return True ...
分类:
其他好文 时间:
2014-10-27 14:17:47
阅读次数:
186