<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[low coder]]></title><description><![CDATA[我现在只是一个low coder]]></description><link>https://blog.youkuaiyun.com/logic_nut</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; logic_nut]]></copyright><item><title><![CDATA[Leetcode: Linked List Cycle II]]></title><link>https://blog.youkuaiyun.com/logic_nut/article/details/18852585</link><guid>https://blog.youkuaiyun.com/logic_nut/article/details/18852585</guid><author>logic_nut</author><pubDate>Wed, 29 Jan 2014 00:39:51 +0800</pubDate><description><![CDATA[http://oj.leetcode.com/problems/linked-list-cycle-ii/
参考了http://blog.youkuaiyun.com/whuwangyi/article/details/14103993
/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *    ]]></description><category></category></item><item><title><![CDATA[Leetcode: Permutations  and Permutations II]]></title><link>https://blog.youkuaiyun.com/logic_nut/article/details/13620767</link><guid>https://blog.youkuaiyun.com/logic_nut/article/details/13620767</guid><author>logic_nut</author><pubDate>Wed, 30 Oct 2013 08:35:27 +0800</pubDate><description><![CDATA[http://oj.leetcode.com/problems/permutations/



class Solution {
public:
    void Permute(vector &num, vector &used, int depth, vector> &res, vector ¤t){
        if(depth==num.size()){
          ]]></description><category></category></item><item><title><![CDATA[Leetcode: Jump Game]]></title><link>https://blog.youkuaiyun.com/logic_nut/article/details/13504409</link><guid>https://blog.youkuaiyun.com/logic_nut/article/details/13504409</guid><author>logic_nut</author><pubDate>Tue, 29 Oct 2013 11:16:49 +0800</pubDate><description><![CDATA[http://oj.leetcode.com/problems/jump-game/



class Solution {
public:
    // Don't code too fast
    // The bad dp algorithm below (commented out) has the complexity of O(N*N)
    /*bool search(i]]></description><category></category></item><item><title><![CDATA[Trapping Rain Water]]></title><link>https://blog.youkuaiyun.com/logic_nut/article/details/13503901</link><guid>https://blog.youkuaiyun.com/logic_nut/article/details/13503901</guid><author>logic_nut</author><pubDate>Tue, 29 Oct 2013 10:56:29 +0800</pubDate><description><![CDATA[http://oj.leetcode.com/problems/trapping-rain-water/



// Find the solution from the internet
// For each individual slot, the capacity depends on the leftHighest and rightHighest
// The naive s]]></description><category></category></item><item><title><![CDATA[Leetcode: Subsets II]]></title><link>https://blog.youkuaiyun.com/logic_nut/article/details/13502317</link><guid>https://blog.youkuaiyun.com/logic_nut/article/details/13502317</guid><author>logic_nut</author><pubDate>Tue, 29 Oct 2013 09:19:27 +0800</pubDate><description><![CDATA[http://oj.leetcode.com/problems/subsets-ii/



class Solution {
public:
    // First, we sort the input set
    // Second, whenever we have a new element, we count the number of this element
    /]]></description><category></category></item><item><title><![CDATA[Leetcode: Search for a Range]]></title><link>https://blog.youkuaiyun.com/logic_nut/article/details/13502111</link><guid>https://blog.youkuaiyun.com/logic_nut/article/details/13502111</guid><author>logic_nut</author><pubDate>Tue, 29 Oct 2013 08:56:22 +0800</pubDate><description><![CDATA[http://oj.leetcode.com/problems/search-for-a-range/



class Solution {
public:
    // Don't try to find one and then extend to the start direction and end direction
    // The time complexity wil]]></description><category></category></item><item><title><![CDATA[Leetcode: Minimum Depth of Binary Tree]]></title><link>https://blog.youkuaiyun.com/logic_nut/article/details/13502021</link><guid>https://blog.youkuaiyun.com/logic_nut/article/details/13502021</guid><author>logic_nut</author><pubDate>Tue, 29 Oct 2013 08:45:34 +0800</pubDate><description><![CDATA[http://oj.leetcode.com/problems/minimum-depth-of-binary-tree/



class Solution {
public:
    // !!!
    // root==NULL doesn't indicate leaf node
    // root->left==root->right==NULL does indicate]]></description><category></category></item><item><title><![CDATA[Leetcode: Combinations]]></title><link>https://blog.youkuaiyun.com/logic_nut/article/details/13501961</link><guid>https://blog.youkuaiyun.com/logic_nut/article/details/13501961</guid><author>logic_nut</author><pubDate>Tue, 29 Oct 2013 08:34:30 +0800</pubDate><description><![CDATA[http://oj.leetcode.com/problems/combinations/



class Solution {
private:
    vector used;
    vector > res;
    vector current;
public:
    // It asks for all the combinations, so we need the va]]></description><category></category></item><item><title><![CDATA[Leetcode: Search in Rotated Sorted Array II]]></title><link>https://blog.youkuaiyun.com/logic_nut/article/details/13501951</link><guid>https://blog.youkuaiyun.com/logic_nut/article/details/13501951</guid><author>logic_nut</author><pubDate>Tue, 29 Oct 2013 08:33:00 +0800</pubDate><description><![CDATA[http://oj.leetcode.com/problems/search-in-rotated-sorted-array-ii/



class Solution {
public:
    // The time complexity is O(N) in worest case
    // For example, A[]={1,1,1,1,1,1,1,1,1,1} and t]]></description><category></category></item><item><title><![CDATA[Leetcode: Search in Rotated Sorted Array]]></title><link>https://blog.youkuaiyun.com/logic_nut/article/details/13501945</link><guid>https://blog.youkuaiyun.com/logic_nut/article/details/13501945</guid><author>logic_nut</author><pubDate>Tue, 29 Oct 2013 08:30:38 +0800</pubDate><description><![CDATA[http://oj.leetcode.com/problems/search-in-rotated-sorted-array/



class Solution {
public:
    // The key idea is that the start value and end value
    // can limite possible values of the array]]></description><category></category></item><item><title><![CDATA[Leetcode: 3Sum Closest]]></title><link>https://blog.youkuaiyun.com/logic_nut/article/details/13501941</link><guid>https://blog.youkuaiyun.com/logic_nut/article/details/13501941</guid><author>logic_nut</author><pubDate>Tue, 29 Oct 2013 08:29:35 +0800</pubDate><description><![CDATA[http://oj.leetcode.com/problems/3sum-closest/



class Solution {
public:
    // Similar to 3Sum Equal
    // Enumerate the minimal number, and then it becomes similar to 2Sum Equal
    // The ove]]></description><category></category></item><item><title><![CDATA[Leetcode: Sum Root to Leaf Numbers]]></title><link>https://blog.youkuaiyun.com/logic_nut/article/details/13501907</link><guid>https://blog.youkuaiyun.com/logic_nut/article/details/13501907</guid><author>logic_nut</author><pubDate>Tue, 29 Oct 2013 08:18:50 +0800</pubDate><description><![CDATA[http://oj.leetcode.com/problems/sum-root-to-leaf-numbers/



// Tried many times to get accepted
// Take care:
// 1. root is NULL
// 2. node with one child
// 3. leaf
class Solution {
public:
    ]]></description><category></category></item><item><title><![CDATA[Leetcode: Set Matrix Zeroes]]></title><link>https://blog.youkuaiyun.com/logic_nut/article/details/13291511</link><guid>https://blog.youkuaiyun.com/logic_nut/article/details/13291511</guid><author>logic_nut</author><pubDate>Mon, 28 Oct 2013 13:21:18 +0800</pubDate><description><![CDATA[http://oj.leetcode.com/problems/set-matrix-zeroes/



// For constant memory requirement, we normaly have two ways:
// 1. Finding a way to use a few variables to represent the status
// 2. Using t]]></description><category></category></item><item><title><![CDATA[Leetcode: Sort Colors]]></title><link>https://blog.youkuaiyun.com/logic_nut/article/details/13291291</link><guid>https://blog.youkuaiyun.com/logic_nut/article/details/13291291</guid><author>logic_nut</author><pubDate>Mon, 28 Oct 2013 12:56:36 +0800</pubDate><description><![CDATA[http://oj.leetcode.com/problems/sort-colors/



// The easy way is to use count sort, but it is going to need two-pass
// The solution below need one-pass.
// The idea is to keep all the numbers b]]></description><category></category></item><item><title><![CDATA[Leetcode: Remove Duplicates from Sorted Array II]]></title><link>https://blog.youkuaiyun.com/logic_nut/article/details/13290391</link><guid>https://blog.youkuaiyun.com/logic_nut/article/details/13290391</guid><author>logic_nut</author><pubDate>Mon, 28 Oct 2013 11:31:29 +0800</pubDate><description><![CDATA[http://oj.leetcode.com/problems/remove-duplicates-from-sorted-array-ii/



class Solution {
public:
    int removeDuplicates(int A[], int n) {
        int current=0;
        for(int i=0;i<n;i++){
]]></description><category></category></item><item><title><![CDATA[Leetcode: Single Number II]]></title><link>https://blog.youkuaiyun.com/logic_nut/article/details/13289735</link><guid>https://blog.youkuaiyun.com/logic_nut/article/details/13289735</guid><author>logic_nut</author><pubDate>Mon, 28 Oct 2013 10:55:33 +0800</pubDate><description><![CDATA[http://oj.leetcode.com/problems/single-number-ii/



#include "stdio.h"
#include 
#include 
using namespace std;
// Took more than two hours
// Bit operation is not trival

// Record the number of]]></description><category></category></item><item><title><![CDATA[Leetcode: Remove Nth Node From End of List]]></title><link>https://blog.youkuaiyun.com/logic_nut/article/details/13287505</link><guid>https://blog.youkuaiyun.com/logic_nut/article/details/13287505</guid><author>logic_nut</author><pubDate>Mon, 28 Oct 2013 08:13:17 +0800</pubDate><description><![CDATA[http://oj.leetcode.com/problems/remove-nth-node-from-end-of-list/



/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     ListNode *next;
 *     ListNode(int x) : ]]></description><category></category></item><item><title><![CDATA[Leetcode: Balanced Binary Tree]]></title><link>https://blog.youkuaiyun.com/logic_nut/article/details/12769513</link><guid>https://blog.youkuaiyun.com/logic_nut/article/details/12769513</guid><author>logic_nut</author><pubDate>Thu, 17 Oct 2013 06:58:30 +0800</pubDate><description><![CDATA[http://oj.leetcode.com/problems/balanced-binary-tree/



/**
 * Definition for binary tree
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode(int x]]></description><category></category></item><item><title><![CDATA[Leetcode: Integer to Roman]]></title><link>https://blog.youkuaiyun.com/logic_nut/article/details/12769471</link><guid>https://blog.youkuaiyun.com/logic_nut/article/details/12769471</guid><author>logic_nut</author><pubDate>Thu, 17 Oct 2013 06:58:23 +0800</pubDate><description><![CDATA[http://oj.leetcode.com/problems/integer-to-roman/



class Solution {
public:
    string intToRoman(int num, int pos){
        char *cc="IVXLCDM  ";
        string res;
        char a=cc[pos*2],b=]]></description><category></category></item><item><title><![CDATA[Leetcode: Best Time to Buy and Sell Stock]]></title><link>https://blog.youkuaiyun.com/logic_nut/article/details/12769495</link><guid>https://blog.youkuaiyun.com/logic_nut/article/details/12769495</guid><author>logic_nut</author><pubDate>Thu, 17 Oct 2013 06:58:19 +0800</pubDate><description><![CDATA[http://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock/



class Solution {
public:
    int maxProfit(vector &prices) {
        // Note: The Solution object is instantiated only once and]]></description><category></category></item></channel></rss>