摘要:
新地址 https://www.gitbook.com/book/warmland/algorithm/details 阅读全文
摘要:
ref: http://www.lintcode.com/en/problem/coins-in-a-line-ii/# 有个博客说的挺好的,比九章自己写的清楚 http://www.cnblogs.com/theskulls/p/4963317.html 意思是这样的: 如果我们在第i个位置,那么 阅读全文
摘要:
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 阅读全文
摘要:
ref: https://leetcode.com/problems/coin-change/ 就是完全背包问题,可以再复习一遍背包问题。 01背包: for 每一个item for amount...cost[item] f[v] = Max{f[v], f[v-cost[item]] + wei 阅读全文
摘要:
ref: https://leetcode.com/problems/ternary-expression-parser/ Given a string representing arbitrarily nested ternary expressions, calculate the result 阅读全文
摘要:
ref: https://leetcode.com/problems/reconstruct-itinerary/ Given a list of airline tickets represented by pairs of departure and arrival airports [from 阅读全文
摘要:
题目本身: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 阅读全文
摘要:
有点没有完全想明白。 能够理解的点有: 1. 给你一个sorted list,用这里面的树构建bst,说明这个list是该bst的inorder遍历。 2. 给你的list相当于一个queue,每次用掉一个node就往后移动一格,相当于queue.poll(); 3. 和之前那题serialize的 阅读全文
摘要:
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 阅读全文
摘要:
首先说一下Reservoir Sampling的原理 ref: http://www.geeksforgeeks.org/reservoir-sampling/ 分析其中的概率: 对于第i个数,它被换入水塘的概率是 k/i,并且在下一次替换中,下一个数被替换进去的概率是 k/i+1,刚好替换到它的概 阅读全文