自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(32)
  • 收藏
  • 关注

原创 Bind - 验证forwarders工作模式-随机转发

假设我们有三个内网DNS服务器10.132.1.163,10.132.1.173, 10.132.1.183,现在需要在这三个服务器之前搭建一个Bind,将一级域名mfw的解析请求转到这三个服务器进行解析,即启用Bind的forward模式。假设我们在10.152.1.14这台机器上部署了Bind服务,并修改named.conf配置文件,启用forwardBind forward配置如下:...

2019-08-28 09:44:22 2744

原创 Go源代码学习之sort包 (一)

Go源代码学习:sort 归并排序实现在sort包中实现的归并排序方法叫Stable 排序:相关函方法:insertionSortstablesymMergeswapRangerotate详细介绍:1、insertionSort(data Interface, a, b int)简单的插入排序,这里不做细节解释:原理是假设前半段数据是有序的...

2019-08-26 15:57:40 316

原创 windows,mac,linux如何配置python+selenium+chromedriver

最近在看python写爬虫,博主的开发环境很杂,在家用windows,公司用linux虚拟机,有时也用mac。子曰:工欲善其事,必先利其器。所以,如何在这三个环境下配置开发环境是一个主要的问题。经过几次尝试,总结出windows 10,centos虚拟机,Mac OS的安装方法。准备工作:1、python编译器:windows下需自行安装python interpreter,mac os及

2018-01-09 10:15:22 1372

转载 Docker学习日记(免sudo使用docker命令)

背景因为使用的是sudo安装docker,所以会导致一个问题。以普通用户登录的状况下,在使用docker images时必须添加sudo,那么如何让docker免sudo依然可用呢?于是开始搜索解决方案。理清楚问题当以普通用户身份去使用docker images时,出现以下错误:Got permission denied while trying to connec

2017-11-21 13:21:04 305

原创 VM安装CentOs7虚拟机后无法上网之解决方法

最近在研究DC/OS的安装,读了很多安装方法后决定先从docker的安装入手,由于DC/OS的安装必须在CentOs7版本以上,所以就在VM下安装了CentOs7,殊不知安装后并不能上网,于是乎又转到研究CentOs7在虚拟机下的上网问题。经过各种版本的尝试后,发现在我的环境下(Windows10 Vmware12.0 CentOs7)如下方法是可行的:1.在windows下查看自己的ip

2017-03-22 14:51:38 48799 17

原创 Leetcode-89 Gray Code

The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequence of

2016-10-25 10:55:25 400

原创 Leetcode-357- Count Numbers with Unique Digits C#

Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x n.Example:Given n = 2, return 91. (The answer should be the total numbers in the range of 0 ≤ x [11,22,33

2016-06-28 16:50:10 400

原创 Leetcode-8-String to Integer(atoi) C++

Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca

2016-06-27 14:24:44 1287

原创 Leetcode-239-Sliding Window Maximum

Given an array nums, there is a sliding window of sizek which is moving from the very left of the array to the very right. You can only see thek numbers in the window. Each time the sliding window

2015-11-18 10:03:52 334

原创 Leetcode-149-Max Ponits on a Line C#

Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.题意:找到在同一直线上的点的最大个数。分析:首先看这个题的暴力方法,两点确定一条直线,所以确定下一条直线后,挨个验证剩下的点是不是也在这条直线上,并记录个数,O(n^3)的时间复杂度就可以解决问

2015-11-12 15:30:48 397

原创 Leetcode-91-Decode Ways C#

A message containing letters fromA-Z is being encoded to numbers using the following mapping: 'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the total nu

2015-11-03 16:16:25 699

原创 Leetcode-43-Multiply Strings C#

Given two numbers represented as strings, return multiplication of the numbers as a string.题意:给两个字符串,返回这两个字符串代表的数字的乘积字符串。解析:把字符串转换成数字,做乘法,再将结果转化回字符串,这种方法肯定是不行的,因为上限问题。所以需要自己实现一个乘法算法。乘法都学过,1234

2015-11-02 10:36:41 598

原创 Leetcode-134-Gas Station C#

There are N gas stations along a circular route, where the amount of gas at stationi is gas[i]. You have a car with an unlimited gas tank and it costscost[i] of gas to travel from station i to i

2015-10-29 09:24:31 499

原创 Leetcode-201- Bitwise AND of Numbers Range

Given a range [m, n] where 0 For example, given the range [5, 7], you should return 4. 题意:m到n若干个数字按位与运算的最后结果,比如5-7,写成2进制分别是0101,0110,0111与运算后得到0100,结果为4。解析:理解了提议之后,就可以立马想到一个暴力破解的方法,直接从m与运算到n就得了呗

2015-10-22 09:47:44 471

原创 WinForm 编程中控件的使用小技巧(splitter实现窗口分区域,改变Button的形状)

一、Splitter 控件的主要作用就是将窗口分区并可以调节区域大小,比如:我想将窗口分为左右两个区域,并可以调节两个区域所占的比例。操作流程如下:1、新建一个窗口:Form1;2、在Form1中添加一个Panel控件Panel1,并将其Dock属性设置为left,BackColor属性设置成蓝色;3、在Form1中添加一个Splitter控件Splitter1,并将其Dock属性设置

2015-10-14 09:33:40 12132

原创 Median of Two Sorted Arrays C++

这道题目很多人认为是leetcode上最经典的题目之一,很早之前就见过这个题目,好像算法导论也有讲过这个题。题意是找两个排好序的数组的中位数,如果不去考虑时间空间复杂度,这个问题极其简单,用merge排序将一个数组归并到另一个数组中去,然后就可以立马找到中位数,不过这样的时间空间复杂度都比较高,其实,按照这个思路写出来的代码也可以AC,可见leetcode的AC标准也不是很严格。那么这个题有没

2015-09-24 16:25:47 505

原创 Trapping Rain Water C#

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.For example, Given [0,1,0,2,1,0,1,3,2,1,2,1]

2015-09-23 16:36:14 466

原创 Ugly Number I II 解析

leetcode上关于ugly number(丑数)的题目有两个,先说一下什么叫丑数,很多博客上关于丑数的解释有比较模糊,有的解释成能被2,3,5整除的数,这是很难理解的一句话,比如14,35明明可以被2和5整除却不是丑数。其实丑数是一种能写成2,3,5的乘方组合(number == 2^m*3^n*5^k,m,n,k为自然数)的形式的数字,比如 180这个数字,可以写成2*2*3*3*5,它

2015-09-15 18:20:28 437

原创 单例模式简介及在WinForm编程中的实现方法

单例模式是在设计模式中经常使用的一种,顾名思义就是实现一个只能创建一个实例对象的类。刚接触面向对象的coder可能比较难理解这种模式有何意义,其实举个例子来讲就比较好理解了:很多人都喜欢打网游,你打开一个登陆器登陆上自己的账号后又想登陆一个别的账号,但是还不想关闭当前这个账号,一般情况下你再打开遍登陆器就可以实现了,此时这些登陆窗口的实现就不是单利模式了。当你登陆游戏后进入你的人物界面,你点击人物

2015-09-14 09:28:26 2107 1

原创 Generate Parentheses C++

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()()

2015-09-11 14:37:12 387

原创 Number of Islands C++

Given a 2d grid map of '1's (land) and'0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assum

2015-09-11 10:09:33 1170

原创 Valid Parentheses C#

Given a string containing just the characters '(', ')', '{', '}', '[' and']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all val

2015-09-08 15:35:00 417

原创 ZigZag Conversion (C实现)

The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H NA P L S I

2015-09-08 14:40:11 1052

原创 Divide Two Integers C#

Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.题意:实现一个除法,不能用division,mod,multiplication这三种运算。当然了能用division,写个毛线啊。这些都不能用,运算里面只有加法了

2015-09-07 13:55:53 530

原创 Fraction to Recurring Decimal C#

Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeating, enclose the repeating part in parentheses.For

2015-09-06 15:34:03 477

原创 Manacher算法之个人愚见

这个俗称“马拉车”的算法的适用问题比较局限,是Manacher在解决寻找字符串中最长回文时提出的一种时间复杂度为O(n)的算法。废话不多说,直接讲算法:字符串预处理首先,在解决回文类型的算法题目时,经常会很头疼的问题就是最终解的回文中字符总数是奇数还是偶数,即abba与aba两种类型,比如判断一个字符串是不是回文就要区别对待这两种情况。但在Manacher算法中首先针对这个问题提出了解决办

2015-09-06 10:50:38 390

原创 Remove Duplicates from Sorted Array II C#

Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array nums = [1,1,1,2,2,3], Your function should return length = 5, with the first five

2015-08-31 15:04:40 302

原创 Search for a Range C#

Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target is not found in

2015-08-27 09:45:20 240

原创 Missing Number

Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.For example,Given nums = [0, 1, 3] return 2. Note:Your algorithm should run

2015-08-26 15:21:09 296

原创 Subsets C#

Given a set of distinct integers, nums, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.For ex

2015-08-26 14:16:14 578

原创 Best Time to Buy and Sell Stock C#

Say you have an array for which the ith element is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),

2015-08-24 10:51:25 529

原创 Combination Sum III C#

Find all possible combinations of k numbers that add up to a numbern, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.Ensure that numbers wit

2015-08-24 09:16:17 405

空空如也

空空如也

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

TA关注的人

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