摘要: 1 class Solution { 2 public: 3 int singleNumber(int A[], int n) { 4 int i,j; 5 for(i=0; i<n; i++) 6 { 7 for(j... 阅读全文
posted @ 2014-06-09 23:12 Marrybe 阅读(283) 评论(0) 推荐(0) 编辑
摘要: There areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requi... 阅读全文
posted @ 2014-06-09 21:49 Marrybe 阅读(166) 评论(0) 推荐(0) 编辑
摘要: For example,Given{1,2,3,4}, reorder it to{1,4,2,3}. 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * Li... 阅读全文
posted @ 2014-06-09 15:25 Marrybe 阅读(730) 评论(0) 推荐(0) 编辑
摘要: 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), ne... 阅读全文
posted @ 2014-06-09 15:20 Marrybe 阅读(153) 评论(0) 推荐(0) 编辑
摘要: //定义二维平面上的点struct Point{ int x; int y; Point(int a=0, int b=0):x(a),y(b){}};bool operator==(const Point& left, const Point& right){ return... 阅读全文
posted @ 2014-06-07 23:39 Marrybe 阅读(1380) 评论(0) 推荐(0) 编辑
摘要: //convert string type value to double type value string s = "23"; double d; istringstream is(s); is>>d; cout<<d<<endl; //输出23 //convert double type ... 阅读全文
posted @ 2014-06-07 19:57 Marrybe 阅读(790) 评论(3) 推荐(0) 编辑