摘要: 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int cnk(int n, int k) 7 { 8 int a,b; 9 a=b=1;10 for(int i=0; i0)28 {... 阅读全文
posted @ 2014-07-04 09:01 Marrybe 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 using namespace std; 5 6 struct GT_cls //创建函数对象 7 { 8 public: 9 GT_cls(int t=0):a(t){}10 11 bool operat... 阅读全文
posted @ 2014-07-03 21:41 Marrybe 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 要求实现函数:void converse(ListNode **head);【输入】head: 链表头节点,空间已经开辟好【输出】head: 逆序后的链表头节点【返回】无【注意】只需要完成该函数功能算法,中间不需要有任何IO的输入输出示例输入:链表 1->2->3->4->5 的头节点head输出:... 阅读全文
posted @ 2014-07-03 11:17 Marrybe 阅读(272) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 10 int calculator(string s) 11 { 12 ... 阅读全文
posted @ 2014-07-03 09:18 Marrybe 阅读(212) 评论(0) 推荐(0) 编辑
摘要: You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb... 阅读全文
posted @ 2014-06-20 12:27 Marrybe 阅读(134) 评论(1) 推荐(0) 编辑
摘要: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ ... 阅读全文
posted @ 2014-06-16 22:50 Marrybe 阅读(242) 评论(0) 推荐(0) 编辑
摘要: Given a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is formed from the orig... 阅读全文
posted @ 2014-06-14 18:07 Marrybe 阅读(126) 评论(0) 推荐(0) 编辑
摘要: Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie... 阅读全文
posted @ 2014-06-12 21:53 Marrybe 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 问题描述:There areNgas stations along a circular route, where the amount of gas at stationiisgas[i].You have a car with an unlimited gas tank and it costs... 阅读全文
posted @ 2014-06-10 19:18 Marrybe 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public: 3 int singleNumber(int A[], int n) { 4 int bits = sizeof(int)*8; 5 int result=0; 6 for(int i... 阅读全文
posted @ 2014-06-10 11:48 Marrybe 阅读(207) 评论(0) 推荐(0) 编辑