摘要: 新地址 https://www.gitbook.com/book/warmland/algorithm/details 阅读全文
posted @ 2016-11-07 07:27 warmland 阅读(118) 评论(0) 推荐(0) 编辑
摘要: ref: http://www.lintcode.com/en/problem/coins-in-a-line-ii/# 有个博客说的挺好的,比九章自己写的清楚 http://www.cnblogs.com/theskulls/p/4963317.html 意思是这样的: 如果我们在第i个位置,那么 阅读全文
posted @ 2016-11-05 06:36 warmland 阅读(228) 评论(0) 推荐(0) 编辑
摘要: ref: http://www.lintcode.com/en/problem/coins-in-a-line/ There are n coins in a line. Two players take turns to take one or two coins from right side 阅读全文
posted @ 2016-11-05 06:10 warmland 阅读(210) 评论(0) 推荐(0) 编辑
摘要: ref: https://leetcode.com/problems/coin-change/ 就是完全背包问题,可以再复习一遍背包问题。 01背包: for 每一个item for amount...cost[item] f[v] = Max{f[v], f[v-cost[item]] + wei 阅读全文
posted @ 2016-11-05 02:48 warmland 阅读(190) 评论(0) 推荐(0) 编辑
摘要: ref: https://leetcode.com/problems/ternary-expression-parser/ Given a string representing arbitrarily nested ternary expressions, calculate the result 阅读全文
posted @ 2016-11-04 07:40 warmland 阅读(365) 评论(0) 推荐(0) 编辑
摘要: ref: https://leetcode.com/problems/reconstruct-itinerary/ Given a list of airline tickets represented by pairs of departure and arrival airports [from 阅读全文
posted @ 2016-11-04 07:09 warmland 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 题目本身:https://leetcode.com/problems/sliding-window-maximum/ Given an array nums, there is a sliding window of size k which is moving from the very left 阅读全文
posted @ 2016-11-03 07:10 warmland 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 有点没有完全想明白。 能够理解的点有: 1. 给你一个sorted list,用这里面的树构建bst,说明这个list是该bst的inorder遍历。 2. 给你的list相当于一个queue,每次用掉一个node就往后移动一格,相当于queue.poll(); 3. 和之前那题serialize的 阅读全文
posted @ 2016-11-01 07:11 warmland 阅读(896) 评论(0) 推荐(1) 编辑
摘要: Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or 阅读全文
posted @ 2016-10-31 12:32 warmland 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 首先说一下Reservoir Sampling的原理 ref: http://www.geeksforgeeks.org/reservoir-sampling/ 分析其中的概率: 对于第i个数,它被换入水塘的概率是 k/i,并且在下一次替换中,下一个数被替换进去的概率是 k/i+1,刚好替换到它的概 阅读全文
posted @ 2016-10-31 08:52 warmland 阅读(285) 评论(0) 推荐(0) 编辑