char 类型是c语言中常见的一个数据类型,string是c++中的一个,它的定义为Strings are objects that represent sequences of characters. 由此可见string是一个char序列的对象,有时候我们经常需要混用这两个数据类型,所以有些常见...
分类:
其他好文 时间:
2014-11-26 18:24:25
阅读次数:
168
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 window is "BANC".
...
很明显的2 pointer问题。。。当满足条件的时候后面的指针加,不满足条件的时候前面的指针加,直到满足条件。。。class Solution {public: int lengthOfLongestSubstringTwoDistinct(string s) { int sta...
分类:
其他好文 时间:
2014-11-26 16:10:45
阅读次数:
336
这个题目很简单,给一个字符串,然后返回最后一个单词的长度就行。题目如下: Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last...
分类:
其他好文 时间:
2014-11-26 01:07:58
阅读次数:
218
本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/41488377
通过本文你可能会学到的知识为:
(1)对String类中的valueOf()方法、charAt()方法、equalsIgnoreCase()方法有所了解,并知道如何使用。
(2)对Character类中的isLetterOrDigit()方法有所了解。
(3)理解解题思路,提高分析问题的能力。
注:
String类:...
分类:
其他好文 时间:
2014-11-25 23:45:17
阅读次数:
258
Validate if a given string is numeric. Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for t...
分类:
其他好文 时间:
2014-11-25 12:23:32
阅读次数:
163
Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.You shoul...
分类:
其他好文 时间:
2014-11-25 12:21:57
阅读次数:
234
题目描述:
Evaluate the value of an arithmetic expression in Reverse Polish Notation.
Valid operators are +, -, *, /.
Each operand may be an integer or another expression.
Some examples:
...
分类:
其他好文 时间:
2014-11-25 10:53:22
阅读次数:
250
本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/41450987
本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/41450987
通过本文你能学到如下知识:
(1)对数据结构中栈的理解,特别是Stack类中的peek()方法和pop()方法的区别。
(2)理解解题思路,提高思考问题的能力。
Given a string co...
分类:
编程语言 时间:
2014-11-24 22:40:46
阅读次数:
257
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...
分类:
其他好文 时间:
2014-11-24 19:21:31
阅读次数:
162