[LeetCode] Majority Element II
Majority Element IIGiven an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space. 解题思路:此前做了一道题目...
[LeetCode] Unique Paths
Unique PathsA robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in tim...
[LeetCode] Maximal Square
Maximal SquareGiven a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.For example, given the following matrix:1 0 1 ...
[LeetCode] Palindrome Linked List
Palindrome Linked ListGiven a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space? 解题思路:此题的题意为判断单向链表是否为回文。难点就是链表不能随机存取,而且不能反向遍历。一个思想就是找到中间节点,...
[LeetCode] Kth Smallest Element in a BST
Kth Smallest Element in a BSTGiven a binary search tree, write a function kthSmallestto find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST's tot...
[LeetCode] Lowest Common Ancestor of a Binary Tree
Lowest Common Ancestor of a Binary Tree Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LCA on Wikipedia: “The lowest...
[LeetCode] Delete Node in a Linked List
Delete Node in a Linked ListWrite a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 ...
[LeetCode] Lowest Common Ancestor of a Binary Search Tree
Lowest Common Ancestor of a Binary Search TreeGiven a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia...
[LeetCode] Search a 2D Matrix II
Search a 2D Matrix IIWrite 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 in ascendin...
[LeetCode] Product of Array Except Self
Product of Array Except SelfGiven an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all th...
vs2013创建、安装、调试Windows Service程序
Windows服务以服务的形式运行,有些情况下非常有用。用VS2013创建windows服务的过程如下:创建服务。1、文件-》新建-》项目-》windows桌面-》windows服务,修改你要的项目名称。我这不改名,仍叫WindowsService1,确定。2、产生的项目文件结构如图所示。右侧的Program.cs文件是入口,Service1.cs是服务文件,所有的逻辑都在这。Service1.c...
[LeetCode] Implement Queue using Stacks
Implement Queue using StacksImplement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front of queue.peek() -- Get ...
[LeetCode] Summary Ranges
Summary RangesGiven a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"...
[LeetCode] Power of Two
Power of TwoGiven an integer, write a function to determine if it is a power of two.Credits:Special thanks to @jianchao.li.fighter for adding this problem and creating all test cases.解题思路:这道...
Azure搭建shadowsocks用作科学上网
我在CSDN中写的一篇博客,题名为“Azure搭建openvpn(番羽土啬必备)”,没有想到第二天就被删了~于是这里用“科学上网”这个词,多么和谐啊! 此前写的那篇openvpn,是在公司搭建的,公司的网络是外网,因此能够work。在宿舍的时候,发现openvpn的客户端不能连接上。原来强大的GWF已经将...
molebox launcher fatal (could not open boxfile)
运行一个exe程序,弹出以下框:可能是系统的环境设置问题。你的文件中的路径包括中文,但是你的系统可能是英文的。按教程http://www.kangry.net/blog/?type=article&article_id=40操作重启电脑即可。
Azure搭建Openvpn
update in 2015-07-05长城太牛逼,将openvpn都给封了,导致此教程不用。挂了~我搭openvpn是在公司的国外网,因此能够work。待我回去宿舍,发现不能客户端不能链接。于是我重新找另外的解决方案~Azure搭建shadowsocks用作科学上网http://www.kangry.net/blog/?type=article&article_id=275 以...
通过文件对比工具Merge数据库
项目分成线下开发版、线上测试版、线上生产版,因此对应有三个数据库。对于一些静态数据,常常需要同步。修改了线下的开发版本,同时也需要更新线上的测试版和线上生产版数据库,有时候线上的一些数据库修改,也要体现在线下来。这是双向的关系,因此不能简单的将一个数据库覆盖另外一个数据库。现在介绍一种数据合并方法。环境:SQL Server Management Studio,Window 8.1软件:winme...
《算法竞赛入门经典》第一章
1.PI除了宏定义外,更好的办法可以通过下面获得:#include const double pi=acos(-1.0);2.通过程序计时:#include int main(){ ... ...
我要长高!!坚持就是胜利!(1)
成年人的骨骺已经闭合,不可能再长高。这是个让人很烦恼的问题,但瑜伽增高可以助你一臂之力!瑜伽增高,瑜伽中有很多的增高动作,同时也能使自身的韧带得到史无前例的充分放松。瑜伽增高的原理是:基本上每个人的脊柱都会或多或少有些不正,不正的程度决定您是否含胸驼背。通过瑜伽体式的练习,以正确的方向地不断舒展,伸展、扩宽骨间隙,增加身高的长度,让脊柱直起来。平时弯腰驼背,坐姿不正,谈话含胸,长时间久坐的伽人,通...