For a given chemical formula represented by a string, count the number of atoms of each element contained in the molecule and return an object. 1 wate...
分类:
其他好文 时间:
2015-07-10 00:11:30
阅读次数:
152
Permutations
Given a collection of numbers, return all possible permutations.
For example,
[1,2,3] have the following permutations:
[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2],
and [3,2,1]...
分类:
其他好文 时间:
2015-07-09 22:45:59
阅读次数:
154
demo 二元函数对象
#include
#include
#include
#include
using namespace std;
template
class SumVector
{
public:
T operator()(T t1, T t2) // 二元函数对象
{
return t1 + t2;
}
protected:
private:
};
void...
分类:
编程语言 时间:
2015-07-09 22:45:12
阅读次数:
194
寻找回文数寻找回文数也是一个比较好玩的题目,也是学习python的一个简单的filter()函数的应用解决方法:即按照回文数的特点进行即可。方法一:一行代码解决#coding=UTF-8
#寻找回文数
def is_palindrome(n):
s=str(n)
return s[0:len(s)//2]==s[-1:len(s)//2:-1]...
分类:
编程语言 时间:
2015-07-09 22:44:12
阅读次数:
288
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,
Given [3,2,1,5,6,4] and k = 2, return 5.Note:...
分类:
其他好文 时间:
2015-07-09 22:41:43
阅读次数:
113
bool g_InvalidInput = false;
int FindGreatestSumOfSubArray(int *pData, int nLength)
{
if ((pData == NULL) || (nLength
{
g_InvalidInput = true;
return 0;
}
g_InvalidInput = false;
int nCurSum...
分类:
编程语言 时间:
2015-07-09 21:32:12
阅读次数:
246
public ListNode deleteDuplicates(ListNode head) { if(head==null || head.next==null) return head; ListNode pre=head;; ...
分类:
其他好文 时间:
2015-07-09 21:22:49
阅读次数:
141
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or...
分类:
其他好文 时间:
2015-07-09 19:38:18
阅读次数:
112
Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word doe...
分类:
其他好文 时间:
2015-07-09 19:22:32
阅读次数:
96
Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
You may assume...
分类:
其他好文 时间:
2015-07-09 18:07:25
阅读次数:
125