摘要: Say Given a 2d array where all the numbers in the array are in increasing order from left to right and top to bottom.What is the best way to search and determine if a target number is in the array?sample:int a[][] = { {1, 3, 5, 7, 9}, {2, 6, 11, 13, 15}, {4, 12, 17, 19, 21}, {8, 14, 18, 23, 25}/... 阅读全文
posted @ 2012-01-06 12:02 百分百好牛 阅读(481) 评论(0) 推荐(0) 编辑
摘要: Sum the linked lists 1->2->3 4->5result is 1->6->81->5->95->3result 2->1->2A: 把链表的值加起来,注意,根据sample,是从链表的最后一位开始相加,而且,要考虑进位的问题pseudo code如下 (通过编译,但没有测试用例)View Code LinkNode* SumLinkLists(LinkNode *p1, LinkNode *p2){ if (NULL == p1 && NULL == p2) return NULL; if (N 阅读全文
posted @ 2012-01-06 11:12 百分百好牛 阅读(161) 评论(0) 推荐(0) 编辑
摘要: There is integer array like {1,2,4,5,6,1,2,4,3,5,7,2,1}. I want to find the possible combination of pair which sum is 4. input : {1,2,4,5,6,1,2,4,3,5,7,2,1}output : {1,1,2}, {2,2}, {3,1}, {1,2,1}...etc which make the sum as 4A:这是一个subset sum problem问题,该类型问题的解法见 wiki,比较复杂http://en.wikipedia.org/wiki/ 阅读全文
posted @ 2012-01-06 10:11 百分百好牛 阅读(295) 评论(0) 推荐(0) 编辑
摘要: Fill in the blanks:_ _ _ H I K L M N T_ _ _ G J O P Q R SA:第一行所有的字母都是直线组成的第二行所有的字母都包括有曲线所以第一行前面补 A E F第二行前面补 B C D 阅读全文
posted @ 2012-01-06 09:44 百分百好牛 阅读(181) 评论(0) 推荐(0) 编辑