上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 30 下一页
摘要: Description:Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twic... 阅读全文
posted @ 2015-06-27 23:09 Rosanne 阅读(170) 评论(0) 推荐(0) 编辑
摘要: Description:Given an array of integers and an integerk, find out whether there there are two distinct indicesiandjin the array such thatnums[i] = nums... 阅读全文
posted @ 2015-06-27 23:04 Rosanne 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Description:Find the total area covered by tworectilinearrectangles in a2Dplane.Each rectangle is defined by its bottom left corner and top right corn... 阅读全文
posted @ 2015-06-27 19:53 Rosanne 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 分析:对于x和y1.首先计算各位相加但不计进位;2.记下进位;3.把前步的结果相加。 1 int add(int num1, int num2) 2 { 3 int sum, carry; 4 do 5 { 6 sum = num1^num2; 7 carry = (nu... 阅读全文
posted @ 2015-06-25 17:31 Rosanne 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 解法一:把构造函数设为私有 将构造函数定义为私有,然后通过定义公有的静态函数来创建和释放类的实例。 1 class SealedClass 1 2 { 3 public: 4 static SealedClass1* GetInstance() 5 { 6 ret... 阅读全文
posted @ 2015-06-25 17:18 Rosanne 阅读(203) 评论(0) 推荐(0) 编辑
摘要: Description:Reverse a singly linked list.Code: 1 ListNode* reverseList(ListNode* head) { 2 ListNode* preNode = NULL; 3 ListNode* p = head; 4 ... 阅读全文
posted @ 2015-06-25 12:16 Rosanne 阅读(166) 评论(0) 推荐(0) 编辑
摘要: Description:Remove all elements from a linked list of integers that have valueval.ExampleGiven:1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6,val= 6Return:1 --... 阅读全文
posted @ 2015-06-25 12:08 Rosanne 阅读(264) 评论(0) 推荐(0) 编辑
摘要: Description:Given a range [m, n] where 0 =0; i++)15 x = x&i;16 return x;17 }18 }View Code 阅读全文
posted @ 2015-06-25 11:36 Rosanne 阅读(178) 评论(0) 推荐(0) 编辑
摘要: Description:Given a 2d grid map of'1's (land) and'0's (water), count the number of islands. An island is surrounded by water and is formed by connecti... 阅读全文
posted @ 2015-06-25 11:25 Rosanne 阅读(246) 评论(0) 推荐(0) 编辑
摘要: Description:Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to botto... 阅读全文
posted @ 2015-06-25 11:21 Rosanne 阅读(164) 评论(0) 推荐(0) 编辑
上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 30 下一页