上一页 1 2 3 4 5 6 7 ··· 10 下一页

2014年2月19日

摘要: Given a set ofnon-overlappingintervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Example 1:Given intervals[1,3],[6,9], insert and merge[2,5]in as[1,5],[6,9].Example 2:Given[1,2],[3,5],[6,7],[8 阅读全文
posted @ 2014-02-19 17:50 小唯THU 阅读(404) 评论(0) 推荐(0) 编辑

2014年2月18日

摘要: 所谓ensemble learning,简单来说,是指综合多种基础模型或弱分类器来完成最终的决策的机器学习方法。Bagging和Boosting(之前所提到的Adaboost)都属于这类方法。Combining a series of T learned classifiers C1,…,CTwith the aim of creating an improved composite classifier C*Random Forest也是一种基于ensemble learning思想的算法,该算法在决策树Bagging的基础上又增加了一层随机因素,在实际的分类和回归任务中,都取得了非常好的效 阅读全文
posted @ 2014-02-18 18:06 小唯THU 阅读(1221) 评论(0) 推荐(0) 编辑

2014年2月16日

摘要: Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path.Note:You can only move either down or right at any point in time.思路:这题不要想得太复杂,什么搜索策略什么贪心什么BFS DFS。其实就是个DP基础题,迭代从上到下从左往右计算每个格子的距离就行了,目标是计算右下角的格子,没必要开二维数组,每次只需 阅读全文
posted @ 2014-02-16 20:20 小唯THU 阅读(346) 评论(0) 推荐(0) 编辑
摘要: Given two words (startandend), and a dictionary, find the length of shortest transformation sequence fromstarttoend, such that:Only one letter can be changed at a timeEach intermediate word must exist in the dictionaryFor example,Given:start="hit"end="cog"dict=["hot",&q 阅读全文
posted @ 2014-02-16 11:17 小唯THU 阅读(758) 评论(0) 推荐(0) 编辑

2014年2月14日

摘要: 下面是一个简单的csv文件Title,Release Date,DirectorAnd Now For Something Completely Different,1971,Ian MacNaughtonMonty Python And The Holy Grail,1975,Terry Gilliam and Terry JonesMonty Python's Life Of Brian,19... 阅读全文
posted @ 2014-02-14 14:20 小唯THU 阅读(4545) 评论(0) 推荐(0) 编辑

2014年2月13日

摘要: Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()()()"思路:有关Parentheses的题目也是比较常见的,除了Generate Parentheses还有Valid Pa 阅读全文
posted @ 2014-02-13 20:51 小唯THU 阅读(570) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?思路这题是Linked List Cycle的进阶版Given a linked list, determine if it has a cycle in it. 1 bool hasCycle(ListNode *head) { 2 if(head == NULL) return false; ... 阅读全文
posted @ 2014-02-13 19:38 小唯THU 阅读(449) 评论(0) 推荐(0) 编辑
摘要: The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the total number of bits in the code, print the sequence of gray code. A gray code sequence must begin with 0.For example, givenn= 2, return[0,1,3,2]. Its gray code s 阅读全文
posted @ 2014-02-13 18:36 小唯THU 阅读(827) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?思路:这个题是Single Number的进阶版,如果其他的数都出现两次而不是三次,可以将所有的数进行异或,出现偶数次的bit最后会是0,而target数字中为1的bit没有被抵消而保 阅读全文
posted @ 2014-02-13 17:57 小唯THU 阅读(2145) 评论(2) 推荐(1) 编辑

2014年2月12日

摘要: 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 no duplicates in the array.Here are few examples.[1,3,5,6], 5 → 2[1,3,5,6], 2 → 1[1,3,5,6], 7 → 4[1,3,5,6], 0 → 0思路:其实二分查找是最基本的,本来没 阅读全文
posted @ 2014-02-12 21:31 小唯THU 阅读(180) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 10 下一页

导航