自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(39)
  • 收藏
  • 关注

原创 Ubuntu下修改DNS服务器地址

今天刚装了Ubuntu系统,想修改dns地址,结果网上找了很多方法都解决不了。后来通过直接修改系统文件解决。步骤如下: 1、打开终端,输入以下命令行后打开文件并进行编辑 sudo gedit /etc/resolv.conf2、将文件中原dns地址注释掉或删掉,改为自己想要设置的dns地址。 即修改nameserver后的地址。 如: nameserver 10.8.8.8 n

2017-04-07 00:21:14 2861

原创 Python学习记录六-ubuntu下升级pip报错

今天在Ubuntu下尝试安装Python的一些机器学习相关学习的库,使用pip命令提示 You are using pip version 8.1.1, however version 9.0.1 is available.使用 pip install –upgrade pip命令报错为 Requirement already up-to-date: pip in ./anacond

2017-04-06 13:56:37 2611 1

原创 C++(后台开发面试题)-判断数组中是否存在重复元素

今天进行了今日头条一轮的技术面试,面试官问了这样一道题,给定一个数组,长度为n,数组中的元素均为整数,范围是[0,n-1],问如何判断数组中是否出现重复数字。

2017-03-22 11:43:15 14500 4

原创 Python学习记录五

numpy,matplotlib,sklearn使用pip install scipy安装scipy模块报错

2017-03-11 20:59:56 315

转载 属性类型-区间与比率的理解

在学习《数据挖掘导论》数据这一章时,对属性类型中的区间和比率这两个的区别理解不好,在博客上看到一篇解释得不错的文章,就转载当做记录。原文如下:现在正在学习《数据挖掘导论》数据这一章,下面是我对数据的属性类型-区间比率的一点理解。书上的描述:区间:对于区间属性,值之间的差是有意义的,即存在测量单位。如日历日期、摄氏或华氏温度比率:对于比率属性,差和比率都是有意义的。如绝对温度、货

2017-03-08 10:57:38 4557

原创 Python学习记录四

window下安装pandas模块

2017-03-01 23:30:36 236

原创 Python学习记录三

SyntaxError: Non-ASCII character ‘\xe6

2017-03-01 10:30:44 270

原创 Python学习记录二

今天在尝试使用Python抓取网页中内容的时候,遇到了一个问题-就是控制台中文输出乱码的问题。 Python的第三方库chardet,

2017-02-28 10:11:00 283

原创 Python学习记录一

python学习

2017-02-26 23:06:29 213

原创 LeetCode学习篇二十七——Maximum Subarray

题目:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1] has

2016-12-05 14:22:18 237

原创 LeetCode学习篇二十六——Maximum Product Subarray

题目:Find the contiguous subarray within an array (containing at least one number) which has the largest product.

2016-12-05 13:55:37 189

原创 算法概论8.15题解

题目:证明以下问题是NP完全问题最大公共子图输入:两个图G1=(V1,E1)和G2=(V2,E2);预算b输出:两个节点集合V1'⊆V1且V2'⊆V2,它们被移除后,将在两图中剩下至少b个节点,且图的剩余部分完全一样。首先证明该问题是NP问题给定一组解,即两个节点集合,我们可以在多项式时间内验证该解然后证明该问题是NP难问题考虑将最大独立集问题归约到最大公共子图

2016-11-30 17:20:35 494

原创 算法概论8.3题解

题目:吝啬SAT是这样一种问题:给定一组子句(每个子句都是其中文字的析取)和一个整数k,求一个最多有k个变量为true的满足赋值,如果这样的赋值存在的话。证明吝啬SAT问题是NP完全问题。要证明一个问题是NP完全问题,就要证明它是NP的和NP-Hard的首先证明吝啬SAT是NP的很明显,给定一组文字的赋值,我们能在多项式时间内验证该解,因此是NP的。然后证明吝啬SAT是NP-Har

2016-11-30 16:43:28 300

原创 LeetCode学习篇二十五——Balanced Binary Tree

题目:Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ

2016-11-22 15:32:35 322

原创 LeetCode学习篇二十四——Path Sum II

题目:Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum.For example:

2016-11-22 15:01:24 210

原创 LeetCode学习篇二十三——Path Sum

题目:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:

2016-11-22 14:42:18 192

原创 LeetCode学习篇二十二——Decode String

题目:Given an encoded string, return it’s decoded string.The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k is gua

2016-11-17 00:08:16 220

转载 最大流最小割定理(max flow/min cut theory)

网络与流的概念  对于有向图D=(V,A),如果V中有一发点(源)Vs,一收点(汇)Vt,其余均为中间节点,且对A中的每条弧均有权Wij(称为弧容量),则称这样的赋权有向图D为容量网络,记为D=(V,A,W),通过D中弧(Vi,Vj)的物流量为fij,称为弧(Vi,Vj)的流量。所有弧上流量的集合f={fij}称为该网络D的一个流。最大流最小割定理(max flow/min cut

2016-11-16 14:50:01 2806

原创 LeetCode学习篇二十一——Interge Break

题目:Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get.For example, given n = 2, retur

2016-11-09 13:59:30 1079

原创 LeetCode学习篇二十——Bulls and Cows

题目:You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess, you provide a hint t

2016-11-07 21:21:03 209

原创 LeetCode学习篇十九——Climbing Stairs

题目: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

2016-11-07 21:16:41 205

原创 LeetCode学习篇十八——Best Time to Buy and Sell Stock with Cooldown

题目:Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one

2016-11-04 00:34:34 198

原创 LeetCode学习篇十七——Best Time to Buy and Sell Stock II

题目:Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one

2016-11-04 00:10:42 173

原创 LeetCode学习篇十六——Best Time to Buy and Sell Stock

题目:Say you have an array for which the i^th element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),

2016-11-03 23:28:46 163

原创 LeetCode学习篇十五——Unique Binary Search Trees

题目:Given n, how many structurally unique BST’s (binary search trees) that store values 1…n?For example, Given n = 3, there are a total of 5 unique BST’s.

2016-11-01 15:54:05 167

原创 LeetCode学习篇十四——House Robber

题目:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent hou

2016-11-01 13:33:21 246

原创 LeetCode学习篇十三——Perfect Squares

题目:Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, …) which sum to n.For example, given n = 12, return 3 because 12 = 4 + 4 + 4; given n = 13, ret

2016-10-31 21:35:57 211

原创 LeetCode学习篇十二——Count Numbers with Unique Digits

题目:Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10^n.Example: Given n = 2, return 91. (The answer should be the total numbers in the range of 0 ≤ x < 100, exc

2016-10-30 18:17:40 181

原创 LeetCode学习篇十一——Range Sum Query - Immutable

题目:Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Given nums = [-2, 0, 3, -5, 2, -1] sumRange(0, 2) -> 1 sumRange(2, 5) -> -1

2016-10-30 16:05:06 237

原创 leetcode学习篇十——Is Subsequence

题目:Given a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) string,

2016-10-30 11:32:12 182

原创 LeetCode学习篇九——Coin Change

题目:You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of mone

2016-10-26 23:24:41 249

原创 LeetCode学习篇八—— Arithmetic Slices

题目:A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.For example, these are arithmetic sequence:

2016-10-26 19:25:56 212

原创 leetcode学习篇七——Find Minimum in Rotated Sorted Array

试了一些pick one功能,随机选取了一道题,题目如下: 153. Find Minimum in Rotated Sorted Array Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., {0,1,2,4,5,6,7}might become{ 4,5,6,7,0,1,2}).F

2016-10-08 23:17:52 159

原创 leetcode学习篇六——Binary Tree Paths

Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree:利用深度优先搜索遍历二叉树即

2016-10-06 20:15:09 187

原创 leetcode学习篇五——Add Digits

题目如下: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example: Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one

2016-10-06 15:07:00 236

原创 leetcode学习篇四——Majority Element

题目如下: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element

2016-10-06 11:30:27 176

原创 leetcode学习篇三——Different Ways to Add Parentheses

看到leetcode的题有时还是会懵逼,继续做一下分治的题目,题目如下: Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid opera

2016-09-26 15:26:29 205

原创 LeetCode学习篇二——分治法

这星期学习了分治法,所以在leetcode上打算做一些相关的题,随便打开了一道相关算法题,题目如下: Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,

2016-09-11 14:25:50 565

原创 LeetCode学习篇一——Counting Bits

LeetCode学习篇一——Counting Bits

2016-09-04 19:57:01 329 1

空空如也

空空如也

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

TA关注的人

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