<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[nlgshw的专栏]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/nlgshw</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; nlgshw]]></copyright><item><title><![CDATA[request.getHeader("x-forwarded-for") = null ?]]></title><link>https://blog.youkuaiyun.com/nlgshw/article/details/60744349</link><guid>https://blog.youkuaiyun.com/nlgshw/article/details/60744349</guid><author>nlgshw</author><pubDate>Sun, 12 Mar 2017 14:12:03 +0800</pubDate><description><![CDATA[request.getHeader(“x-forwarded-for”) = null ? 
在使用Nginx代理网络请求时，设置proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for，但是的server端(Tomcat，Spring)收到的网络请求中却得不到这个x-forwarded-for的信息。]]></description><category></category></item><item><title><![CDATA[面试题：两个无序数组合并成一个有序数组]]></title><link>https://blog.youkuaiyun.com/nlgshw/article/details/44487989</link><guid>https://blog.youkuaiyun.com/nlgshw/article/details/44487989</guid><author>nlgshw</author><pubDate>Fri, 20 Mar 2015 10:38:18 +0800</pubDate><description><![CDATA[昨天面试，问了一个简单的算法题，当时快速排序的代码有点忘了，还想了一会儿。最后写的估计也还有点问题，再写一遍。
        思路：先分别对两个数组进行排序（可以用快速排序），然后两路归并。

#include 
using namespace std;



class Solution {
public:
	int *sort(int *a,int lenA,int *b,int le]]></description><category></category></item><item><title><![CDATA[LeetCode：Remove Element(删除数组中的特定元素)]]></title><link>https://blog.youkuaiyun.com/nlgshw/article/details/43450595</link><guid>https://blog.youkuaiyun.com/nlgshw/article/details/43450595</guid><author>nlgshw</author><pubDate>Tue, 03 Feb 2015 15:45:45 +0800</pubDate><description><![CDATA[Given an array and a value, remove all instances of that value in place and return the new length.

        The order of elements can be changed. It doesn't matter what you leave beyond the new leng]]></description><category></category></item><item><title><![CDATA[LeetCode：Binary Tree Preorder Traversal(非递归方法前序遍历二叉树)]]></title><link>https://blog.youkuaiyun.com/nlgshw/article/details/43446559</link><guid>https://blog.youkuaiyun.com/nlgshw/article/details/43446559</guid><author>nlgshw</author><pubDate>Tue, 03 Feb 2015 10:42:16 +0800</pubDate><description><![CDATA[Given a binary tree, return the preorder traversal of its nodes' values.
        For example:
        Given binary tree {1,#,2,3},
           1
            \
             2
            /]]></description><category></category></item><item><title><![CDATA[LeetCode：Trapping Rain Water(装雨水问题)]]></title><link>https://blog.youkuaiyun.com/nlgshw/article/details/43410329</link><guid>https://blog.youkuaiyun.com/nlgshw/article/details/43410329</guid><author>nlgshw</author><pubDate>Mon, 02 Feb 2015 22:00:35 +0800</pubDate><description><![CDATA[原题：Given n non-negative integers representing an elevation map where the width of each bar is 1, compute
                       how much water it is able to trap after raining.
                   Fo]]></description><category></category></item><item><title><![CDATA[LeetCode: Remove Duplicates from Sorted Array II（在排序数组中删除重复元素）]]></title><link>https://blog.youkuaiyun.com/nlgshw/article/details/43339385</link><guid>https://blog.youkuaiyun.com/nlgshw/article/details/43339385</guid><author>nlgshw</author><pubDate>Sat, 31 Jan 2015 10:52:57 +0800</pubDate><description><![CDATA[原题：Follow up for "Remove Duplicates": What if duplicates are allowed at most twice?
                   For example,
                   Given sorted array A = [1,1,1,2,2,3],

                   You]]></description><category></category></item><item><title><![CDATA[LeetCode：Rotate List(旋转链表)]]></title><link>https://blog.youkuaiyun.com/nlgshw/article/details/43307207</link><guid>https://blog.youkuaiyun.com/nlgshw/article/details/43307207</guid><author>nlgshw</author><pubDate>Fri, 30 Jan 2015 15:08:53 +0800</pubDate><description><![CDATA[原题：Given a list, rotate the list to the right by k places, where k is non-negative.
        For example:
        Given 1->2->3->4->5->NULL and k = 2,

        return 4->5->1->2->3->NULL.]]></description><category></category></item><item><title><![CDATA[LeetCode：Search a 2D Matrix （在元素递增的矩阵中搜寻特定元素）]]></title><link>https://blog.youkuaiyun.com/nlgshw/article/details/43279207</link><guid>https://blog.youkuaiyun.com/nlgshw/article/details/43279207</guid><author>nlgshw</author><pubDate>Fri, 30 Jan 2015 09:21:09 +0800</pubDate><description><![CDATA[Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
        Integers in each row are sorted from left to right.
        The first int]]></description><category></category></item><item><title><![CDATA[判断给定二叉树是否是二叉搜索树(LeetCode: Validate Binary Search Tree)]]></title><link>https://blog.youkuaiyun.com/nlgshw/article/details/43271823</link><guid>https://blog.youkuaiyun.com/nlgshw/article/details/43271823</guid><author>nlgshw</author><pubDate>Thu, 29 Jan 2015 15:45:03 +0800</pubDate><description><![CDATA[原题：Given a binary tree, determine if it is a valid binary search tree (BST).


方法1：可以根据二叉搜索树的规律写出约束规则。对于二叉搜索树的任意结点，其左子树结点均小于结点本身值，右子树结点均大于结点本身值。根据这个规律可以给出两个变量min和max来限定每个结点的有效取值范围。假设任一结点current的取值范]]></description><category></category></item><item><title><![CDATA[寻找只出现一次的数字(LeetCode: Single Number II)]]></title><link>https://blog.youkuaiyun.com/nlgshw/article/details/43234617</link><guid>https://blog.youkuaiyun.com/nlgshw/article/details/43234617</guid><author>nlgshw</author><pubDate>Wed, 28 Jan 2015 19:30:53 +0800</pubDate><description><![CDATA[原题：Given an array of integers, every element appears three times except for one. Find that single one.
Note:

Your algorithm should have a linear runtime complexity. Could you implement it without]]></description><category></category></item><item><title><![CDATA[有序递增链表转化为平衡的二叉搜索树(LeetCode: Convert Sorted List to Binary Search Tree )]]></title><link>https://blog.youkuaiyun.com/nlgshw/article/details/43195189</link><guid>https://blog.youkuaiyun.com/nlgshw/article/details/43195189</guid><author>nlgshw</author><pubDate>Tue, 27 Jan 2015 15:47:06 +0800</pubDate><description><![CDATA[Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
    首先，这里是有序递增链表，那么链表的中间节点一定是二叉搜索树的根节点，左侧一半为左子树，右侧一半为右子树，这可以构建一个递归的过程。那么如何找到链表的中间节点呢？]]></description><category></category></item><item><title><![CDATA[U盘产生快捷方式病毒]]></title><link>https://blog.youkuaiyun.com/nlgshw/article/details/42493733</link><guid>https://blog.youkuaiyun.com/nlgshw/article/details/42493733</guid><author>nlgshw</author><pubDate>Wed, 07 Jan 2015 16:29:43 +0800</pubDate><description><![CDATA[u盘不小心染了病毒，文件都变成了快捷方式，真实的源文件都变成了隐藏文件，看着这么多快捷方式真是不开心。


这个病毒的机制也很简单，它在u盘里放了一个survival.vbe文件，就感染了u盘，然后在电脑的c盘放两个survival.vbe文件，就达到了感染电脑的目的。


解决方法（删除所有的vbe文件就行了）：
     1.设置文件夹选项，将隐藏文件都显示出来。
     2]]></description><category></category></item><item><title><![CDATA[android自定义圆环控件 滑动选择百分比]]></title><link>https://blog.youkuaiyun.com/nlgshw/article/details/40786409</link><guid>https://blog.youkuaiyun.com/nlgshw/article/details/40786409</guid><author>nlgshw</author><pubDate>Fri, 21 Nov 2014 14:19:30 +0800</pubDate><description><![CDATA[之前做了一个类微信的聊天应用，]]></description><category></category></item><item><title><![CDATA[strcpy、strcmp和memcpy 函数实现]]></title><link>https://blog.youkuaiyun.com/nlgshw/article/details/25156727</link><guid>https://blog.youkuaiyun.com/nlgshw/article/details/25156727</guid><author>nlgshw</author><pubDate>Tue, 06 May 2014 19:23:44 +0800</pubDate><description><![CDATA[#include 
#include 
using namespace std;

//字符串拷贝函数
char* strcpy(char *des,char *src)
{
	assert(des!=NULL&&src!=NULL);
	char *address = des;
	while( (*des++=*src++) != '\0' ) NULL;
	return address;
}
]]></description><category></category></item><item><title><![CDATA[求子数组的最大和]]></title><link>https://blog.youkuaiyun.com/nlgshw/article/details/22810799</link><guid>https://blog.youkuaiyun.com/nlgshw/article/details/22810799</guid><author>nlgshw</author><pubDate>Wed, 02 Apr 2014 17:10:29 +0800</pubDate><description><![CDATA[输入一个整形数组，里有正数负数。
数组中连续的一个或多整数组成子数组，每个子数组都有一个和。
求所有子数组的和最大值。要时间复杂度为 O(n)。
例如输入的数组为 1，-2，3，10，-4，7，2，-5，和最大的子数组为3，10，-4，7，2。
因此输出为该子数组的和 18 。

#include 
using namespace std;
//遍历求和，当和为负数时置零后继续求和
/]]></description><category></category></item><item><title><![CDATA[VS2010+Qt5+OSG3.0开发环境搭建]]></title><link>https://blog.youkuaiyun.com/nlgshw/article/details/19201637</link><guid>https://blog.youkuaiyun.com/nlgshw/article/details/19201637</guid><author>nlgshw</author><pubDate>Fri, 14 Feb 2014 15:36:04 +0800</pubDate><description><![CDATA[(一) VS2010
    VS2010的安装网上教程很多，不再叙述。
(二) Qt
    在VS中开发程序，需要下载Qt安装包和Qt的VS插件。
    我用的版本是Qt5.1.1 for Windows(VS2010,OpenGL)、VisualStudio Add-in 1.2.2 for Qt5。
    Qt装好后需要设置系统环境变量，在Path里加入D:\Qt\Qt5.1]]></description><category></category></item></channel></rss>