Given a string s consists of upper/lower-case alphabets and empty space characters '
', return the length of last word in the string.
If the last word does not exist, return 0.
Note: A word is def...
分类:
其他好文 时间:
2015-04-01 11:23:37
阅读次数:
112
在公司实习期间,慢慢的体会到了作为一名开发人员,公司的Code convention是多么的重要。下面一条便是公司列举出来的。1. Rather than “String”, “StringBuffer” is recommended to be used to concatenate char.....
分类:
编程语言 时间:
2015-04-01 11:19:25
阅读次数:
136
有一个由各种括号组成的字符串,判断其是否合法 合法准则即是否成对匹配(())合法({])不合法())(不合法思路:用栈模拟即可 class Solution {public: bool isValid(string s) { stack stk; for (size_t i = 0; i < s.s...
分类:
其他好文 时间:
2015-04-01 11:00:27
阅读次数:
82
xml格式转成array';$res = @simplexml_load_string($str,NULL,LIBXML_NOCDATA);$res = json_decode(json_encode($res),true);print_r($res);
分类:
Web程序 时间:
2015-04-01 10:59:24
阅读次数:
120
msdn 解释如下:“协变”是指能够使用与原始指定的派生类型相比,派生程度更大的类型。“逆变”则是指能够使用派生程度更小的类型。解释的很正确,大致就是这样,不过不够直白。直白的理解:“协变”->”和谐的变”->”很自然的变化”->string->object :协变。“逆变”->”逆常的变”->”不...
拍扁多维数组、提取URL中的参数变成对象、实现string的trim()函数、判断Email地址、16进制颜色转rgb格式...
分类:
编程语言 时间:
2015-04-01 09:42:06
阅读次数:
190
1、读取sim卡信息
private TelephonyManager tm;
tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
String sim = tm.getSimSerialNumber();
需要TelephonyManager 加权限
2、发短信
SmsManager smsManager = S...
分类:
移动开发 时间:
2015-04-01 09:41:45
阅读次数:
191
在利用Java网络编程时,利用Java获取HTTP Request 和 Response头字段;
可以利用Java语言根据需要添加自定义的HTTP头字段,而不必拘泥于标准HTTP定义的头字段。
代码如下:
public class TestURL {
public static void main(String[] args) {
String destURLStr= ...
分类:
编程语言 时间:
2015-04-01 09:37:54
阅读次数:
145
【思路】:用string的replace方法就行,注意题目中的”内部没有空格“,是内部没有。。所以需要考虑字符串为空或者前后有空格的情况。不能使用cin了,需要用gets等。所以需要把char[]转换成string的步骤。另外,char不能在同一行上先定义字符,后定义字符串。反过来可以,不然会出现不能把字符指针给字符的错误。
【AC代码】:
#include
#include
#inclu...
分类:
其他好文 时间:
2015-04-01 09:37:37
阅读次数:
188
题目:
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).
For example,
S = "ADOBECODEBANC"
T = "ABC"
Minimum windo...