by Xiaokang Zhang | Jan 20, 2017 | Algorithm & Data Structure
Dynamic programming can be very challenging in that: It is hard to find out whether the question can be solved by dynamic programming or not.It is hard to figure out the correct reduction transition function.It is hard to implement the algorithm correctly. Let’s...
by Xiaokang Zhang | Jan 18, 2017 | Algorithm & Data Structure
Roman to Integer Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. To solve this problem, let’s first take a look at all roman numbers. Roman Number Roman number has the following basic symbols: 1: I 5: V...
by Xiaokang Zhang | Jan 17, 2017 | Algorithm & Data Structure
Course Schedule Problem There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1] Given the total number of courses and...
by Xiaokang Zhang | Jan 17, 2017 | Algorithm & Data Structure
Connected components problem Given n nodes label from 0 to n – 1 and a list of undirected edges (each edge is a pair of nodes), write a function to find the number of connected components in an undirected graph: You can assume that no duplicate edges will appear...
by Xiaokang Zhang | Jan 16, 2017 | Economics
在讨论中国制造业的时候,我们除了联想到低成本、大规模,还常常联想到他的高污染。我们从很早就知道,中国制造业的快速发展是以牺牲环境为你代价的,这个代价就是污染。将这条逻辑反过来推理就是,如果控制污染或者减少污染就会牺牲经济发展。这样的逻辑正确吗?是正确的,这样的顾虑也正是很多政策这不愿意努力治理污染的原因:经济发展才是衡量政绩的主要标准。但是控制污染怎样影响经济发展呢?这其中的逻辑链条如何打通?...