<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[ActiveCoder的博客]]></title><description><![CDATA[Algorithms seen]]></description><link>https://blog.youkuaiyun.com/github_34333284</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; github_34333284]]></copyright><item><title><![CDATA[Sort Stack in increasing/decreasing Order.]]></title><link>https://blog.youkuaiyun.com/github_34333284/article/details/52140982</link><guid>https://blog.youkuaiyun.com/github_34333284/article/details/52140982</guid><author>github_34333284</author><pubDate>Sun, 07 Aug 2016 04:37:36 +0800</pubDate><description><![CDATA[Question: Sort a stack in increasing order. Two ways: sort it recursively and use an explicit stack.
// solve it recursively
void insertToStack(stack& s, int value) {
  if(s.empty() || s.top() <= val]]></description><category></category></item><item><title><![CDATA[Delete node in BST]]></title><link>https://blog.youkuaiyun.com/github_34333284/article/details/52134087</link><guid>https://blog.youkuaiyun.com/github_34333284/article/details/52134087</guid><author>github_34333284</author><pubDate>Sat, 06 Aug 2016 07:04:23 +0800</pubDate><description><![CDATA[Question: delete the given value in BST.
This question is pretty tricky, to delete a node in BST, there are several cases to consider.
1: The node one of the leaves


in this case, it is easy, ju]]></description><category></category></item><item><title><![CDATA[Observer Pattern]]></title><link>https://blog.youkuaiyun.com/github_34333284/article/details/52126239</link><guid>https://blog.youkuaiyun.com/github_34333284/article/details/52126239</guid><author>github_34333284</author><pubDate>Fri, 05 Aug 2016 12:06:32 +0800</pubDate><description><![CDATA[Observer Pattern: defines a one-to-many dependency between objects so that when one object changes state, all of its dependent are notified and updated automatically.
The relationship is defined as f]]></description><category></category></item><item><title><![CDATA[Decorating Pattern]]></title><link>https://blog.youkuaiyun.com/github_34333284/article/details/52100952</link><guid>https://blog.youkuaiyun.com/github_34333284/article/details/52100952</guid><author>github_34333284</author><pubDate>Wed, 03 Aug 2016 12:57:39 +0800</pubDate><description><![CDATA[Decorate pattern is to give objects new responsibilities without making any code change to the underlying classes. The Decorator Pattern attaches additional responsibilities to an object dynamically. ]]></description><category></category></item><item><title><![CDATA[Command Pattern]]></title><link>https://blog.youkuaiyun.com/github_34333284/article/details/52090517</link><guid>https://blog.youkuaiyun.com/github_34333284/article/details/52090517</guid><author>github_34333284</author><pubDate>Tue, 02 Aug 2016 05:23:22 +0800</pubDate><description><![CDATA[Command Pattern is usually used in the scenario that we want to perform multiple operations on the same data. For example, in a image processor, we could choose to rotate, flip or invert colors of the]]></description><category></category></item><item><title><![CDATA[Virtual Table -- C++]]></title><link>https://blog.youkuaiyun.com/github_34333284/article/details/52089627</link><guid>https://blog.youkuaiyun.com/github_34333284/article/details/52089627</guid><author>github_34333284</author><pubDate>Mon, 01 Aug 2016 22:58:35 +0800</pubDate><description><![CDATA[Vtables is also known as many different names: virtual function table, virtual method table, and even as a dispatch table.
Usage of Vtables: Polymorphism
when working with virtual function in C++, i]]></description><category></category></item><item><title><![CDATA[Strategy Pattern]]></title><link>https://blog.youkuaiyun.com/github_34333284/article/details/52084631</link><guid>https://blog.youkuaiyun.com/github_34333284/article/details/52084631</guid><author>github_34333284</author><pubDate>Mon, 01 Aug 2016 12:28:52 +0800</pubDate><description><![CDATA[The strategy pattern is to take the parts that vary and encapsulation them, so that later you can alter or extend the parts that vary without affecting those that don't.
In the head first design patt]]></description><category></category></item><item><title><![CDATA[Balanced Partition of Array]]></title><link>https://blog.youkuaiyun.com/github_34333284/article/details/52044383</link><guid>https://blog.youkuaiyun.com/github_34333284/article/details/52044383</guid><author>github_34333284</author><pubDate>Wed, 27 Jul 2016 12:32:47 +0800</pubDate><description><![CDATA[Given an array which contains random positive integers, divide the array into two parts which has the smallest diff sum, return the smallest diff sum.
This problem is solvable using dynamic programmi]]></description><category></category></item><item><title><![CDATA[LeetCode 375. Guess Number Higher or Lower II]]></title><link>https://blog.youkuaiyun.com/github_34333284/article/details/52031911</link><guid>https://blog.youkuaiyun.com/github_34333284/article/details/52031911</guid><author>github_34333284</author><pubDate>Tue, 26 Jul 2016 03:51:16 +0800</pubDate><description><![CDATA[We are playing the Guess Game. The game is as follows:



I pick a number from 1 to n. You have to guess which number I picked.

Every time you guess wrong, I'll tell you whether the number I pi]]></description><category></category></item><item><title><![CDATA[374. Guess Number Higher or Lower]]></title><link>https://blog.youkuaiyun.com/github_34333284/article/details/52029436</link><guid>https://blog.youkuaiyun.com/github_34333284/article/details/52029436</guid><author>github_34333284</author><pubDate>Mon, 25 Jul 2016 23:47:02 +0800</pubDate><description><![CDATA[We are playing the Guess Game. The game is as follows:



I pick a number from 1 to n. You have to guess which number I picked.

Every time you guess wrong, I'll tell you whether the number is h]]></description><category></category></item><item><title><![CDATA[LeetCode 366. Find Leaves of Binary Tree]]></title><link>https://blog.youkuaiyun.com/github_34333284/article/details/52029335</link><guid>https://blog.youkuaiyun.com/github_34333284/article/details/52029335</guid><author>github_34333284</author><pubDate>Mon, 25 Jul 2016 23:29:15 +0800</pubDate><description><![CDATA[Given a binary tree, find all leaves and then remove those leaves. Then repeat the previous steps until the tree is empty.

Example:
Given binary tree 

          1
         / \
        2   3
   ]]></description><category></category></item><item><title><![CDATA[Maximum array distance Sum]]></title><link>https://blog.youkuaiyun.com/github_34333284/article/details/52022611</link><guid>https://blog.youkuaiyun.com/github_34333284/article/details/52022611</guid><author>github_34333284</author><pubDate>Mon, 25 Jul 2016 12:46:31 +0800</pubDate><description><![CDATA[Question: Given an array, find the maximum array distance sum. Array distance sum is defined as below. For any 0 
For example, Given array {0, 2, -1}
A[0][0] = 0, A[0][1] = 3, A[0][2] = 1; A[1][1] =]]></description><category></category></item><item><title><![CDATA[Dynamic Programming series]]></title><link>https://blog.youkuaiyun.com/github_34333284/article/details/51979028</link><guid>https://blog.youkuaiyun.com/github_34333284/article/details/51979028</guid><author>github_34333284</author><pubDate>Thu, 21 Jul 2016 07:08:54 +0800</pubDate><description><![CDATA[DP is absolutely the best way to category levels of programming..... and it is always the favourite questions being asked by FB or Google.
1: Entry Level DP problem.    
/*
  A sequence of numbers i]]></description><category></category></item><item><title><![CDATA[TODO: house robber IIII]]></title><link>https://blog.youkuaiyun.com/github_34333284/article/details/51966703</link><guid>https://blog.youkuaiyun.com/github_34333284/article/details/51966703</guid><author>github_34333284</author><pubDate>Wed, 20 Jul 2016 11:27:42 +0800</pubDate><description><![CDATA[TODO: when rob one, the neighbour explored, get the max rob value.]]></description><category></category></item><item><title><![CDATA[TODO: System design a recommendation system]]></title><link>https://blog.youkuaiyun.com/github_34333284/article/details/51939958</link><guid>https://blog.youkuaiyun.com/github_34333284/article/details/51939958</guid><author>github_34333284</author><pubDate>Mon, 18 Jul 2016 10:40:43 +0800</pubDate><description><![CDATA[TODO: design a recommendation system.]]></description><category></category></item><item><title><![CDATA[Shuffle related problem.]]></title><link>https://blog.youkuaiyun.com/github_34333284/article/details/51938767</link><guid>https://blog.youkuaiyun.com/github_34333284/article/details/51938767</guid><author>github_34333284</author><pubDate>Mon, 18 Jul 2016 09:59:05 +0800</pubDate><description><![CDATA[Shuffle is quite a frequently asked question in interviews. The most famous one is shuffle a deck of cards.
Peiyush Jain, 2004 published a paper "A simple in-place Algorithm for in-Shuffle". However ]]></description><category></category></item><item><title><![CDATA[Haffman Encoding and Decoding]]></title><link>https://blog.youkuaiyun.com/github_34333284/article/details/51935946</link><guid>https://blog.youkuaiyun.com/github_34333284/article/details/51935946</guid><author>github_34333284</author><pubDate>Mon, 18 Jul 2016 06:27:49 +0800</pubDate><description><![CDATA[Read this blog and it seems this is a quite decent interview question. Haffman encoding
Haffman encoding is  a classic way to encode characters. It encodes characters according to building an optimis]]></description><category></category></item><item><title><![CDATA[Find Closet Pairs  -- To be continue]]></title><link>https://blog.youkuaiyun.com/github_34333284/article/details/51866090</link><guid>https://blog.youkuaiyun.com/github_34333284/article/details/51866090</guid><author>github_34333284</author><pubDate>Sat, 09 Jul 2016 12:00:42 +0800</pubDate><description><![CDATA[1: Find closet pair number in an given array
2: Find closet pair of points in an array of given points.
3: Given a set of triangles, find the most overlapped points.  (TODO: Will update them on July]]></description><category></category></item><item><title><![CDATA[Subarray Sum to the given target value]]></title><link>https://blog.youkuaiyun.com/github_34333284/article/details/51848005</link><guid>https://blog.youkuaiyun.com/github_34333284/article/details/51848005</guid><author>github_34333284</author><pubDate>Thu, 07 Jul 2016 06:13:00 +0800</pubDate><description><![CDATA[Question: check if there is a subarray sum equals to the given target.
This question should ask for clarifications. Whether the inputs are all positive, or it has negative numbers.
1: If all the num]]></description><category></category></item><item><title><![CDATA[Primes Product]]></title><link>https://blog.youkuaiyun.com/github_34333284/article/details/51847838</link><guid>https://blog.youkuaiyun.com/github_34333284/article/details/51847838</guid><author>github_34333284</author><pubDate>Thu, 07 Jul 2016 02:15:08 +0800</pubDate><description><![CDATA[Maybe think about how to solve it iteratively??
#include "header.h"
using namespace std;

void primeProduct(vector& nums, vector& res, int product, int pos) {
  if(pos > nums.size()) {
    return;]]></description><category></category></item></channel></rss>