自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(16)
  • 资源 (1)
  • 问答 (1)
  • 收藏
  • 关注

原创 request.getHeader("x-forwarded-for") = null ?

request.getHeader(“x-forwarded-for”) = null ? 在使用Nginx代理网络请求时,设置proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for,但是的server端(Tomcat,Spring)收到的网络请求中却得不到这个x-forwarded-for的信息。

2017-03-12 14:12:03 6699 1

原创 面试题:两个无序数组合并成一个有序数组

昨天面试,问了一个简单的算法题,当时快速排序的代码有点忘了,还想了一会儿。最后写的估计也还有点问题,再写一遍。        思路:先分别对两个数组进行排序(可以用快速排序),然后两路归并。#include using namespace std;class Solution {public: int *sort(int *a,int lenA,int *b,int le

2015-03-20 10:38:18 5459

原创 LeetCode:Remove Element(删除数组中的特定元素)

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

2015-02-03 15:45:45 507

原创 LeetCode:Binary Tree Preorder Traversal(非递归方法前序遍历二叉树)

Given a binary tree, return the preorder traversal of its nodes' values.        For example:        Given binary tree {1,#,2,3},           1            \             2            /

2015-02-03 10:42:16 609

原创 LeetCode:Trapping Rain Water(装雨水问题)

原题: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

2015-02-02 22:00:35 815

原创 LeetCode: Remove Duplicates from Sorted Array II(在排序数组中删除重复元素)

原题: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

2015-01-31 10:52:57 494

原创 LeetCode:Rotate List(旋转链表)

原题: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.

2015-01-30 15:08:53 466

原创 LeetCode:Search a 2D Matrix (在元素递增的矩阵中搜寻特定元素)

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

2015-01-30 09:21:09 438

原创 判断给定二叉树是否是二叉搜索树(LeetCode: Validate Binary Search Tree)

原题:Given a binary tree, determine if it is a valid binary search tree (BST).方法1:可以根据二叉搜索树的规律写出约束规则。对于二叉搜索树的任意结点,其左子树结点均小于结点本身值,右子树结点均大于结点本身值。根据这个规律可以给出两个变量min和max来限定每个结点的有效取值范围。假设任一结点current的取值范

2015-01-29 15:45:03 1176

原创 寻找只出现一次的数字(LeetCode: Single Number II)

原题: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

2015-01-28 19:30:53 578

原创 有序递增链表转化为平衡的二叉搜索树(LeetCode: Convert Sorted List to Binary Search Tree )

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.    首先,这里是有序递增链表,那么链表的中间节点一定是二叉搜索树的根节点,左侧一半为左子树,右侧一半为右子树,这可以构建一个递归的过程。那么如何找到链表的中间节点呢?

2015-01-27 15:47:06 543

原创 U盘产生快捷方式病毒

u盘不小心染了病毒,文件都变成了快捷方式,真实的源文件都变成了隐藏文件,看着这么多快捷方式真是不开心。这个病毒的机制也很简单,它在u盘里放了一个survival.vbe文件,就感染了u盘,然后在电脑的c盘放两个survival.vbe文件,就达到了感染电脑的目的。解决方法(删除所有的vbe文件就行了):     1.设置文件夹选项,将隐藏文件都显示出来。     2

2015-01-07 16:29:43 9742

原创 android自定义圆环控件 滑动选择百分比

之前做了一个类微信的聊天应用,

2014-11-21 14:19:30 2997

原创 strcpy、strcmp和memcpy 函数实现

#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;}

2014-05-06 19:23:44 674

原创 求子数组的最大和

输入一个整形数组,里有正数负数。数组中连续的一个或多整数组成子数组,每个子数组都有一个和。求所有子数组的和最大值。要时间复杂度为 O(n)。例如输入的数组为 1,-2,3,10,-4,7,2,-5,和最大的子数组为3,10,-4,7,2。因此输出为该子数组的和 18 。#include using namespace std;//遍历求和,当和为负数时置零后继续求和/

2014-04-02 17:10:29 543

原创 VS2010+Qt5+OSG3.0开发环境搭建

(一) 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

2014-02-14 15:36:04 5256 4

OpenSceneGraph(OSG) 3 Cookbook

使用OpenGraphScene API 3的3D编程书籍,全是编程例子

2014-02-06

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除