自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

lizhao007

一杯Java 一杯咖啡

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

转载 python数据类型

数据类型计算机顾名思义就是可以做数学计算的机器,因此,计算机程序理所当然地可以处理各种数值。但是,计算机能处理的远不止数值,还可以处理文本、图形、音频、视频、网页等各种各样的数据,不同的数据,需要定义不同的数据类型。在Python中,能够直接处理的数据类型有以下几种: 整数Python可以处理任意大小的整数,当然包括负整数,在程序中的表示方法和数学上的写法一模一样,例如:1,100,-8080,0

2016-05-29 11:33:49 276

转载 在Linux下安装python

系统环境:CentOS 6.5 x86_64 / Fedora 20 x86_64安装相关包# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make下载 Python 3.4 源码包# wget http://mirrors.sohu.

2016-05-29 10:38:44 336

原创 redis之列表类型

列表类型类似我们java里面的双向链表,常用的操作是向列表两端添加元素,或者获得列表的某一个片段。 因为内部是使用双向链表来实现的,所以向列表两端添加元素的时间复杂度为O(1),获取越接近两端的元素速度就越快。就算你有千万级别的数据列表,我们获取头部和尾部的10条记录也是极快的。 当然链表也有可能会访问比较慢,如果我们使用索引访问的方式访问中间部分这样是及其的慢的。一般来说我们插入的时候比较快速

2016-05-29 09:50:44 306

原创 leetcode-144Binary Tree Preorder Traversal

链接:https://leetcode.com/problems/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

2016-05-28 14:49:49 224

原创 leetcode- 268. Missing Number

链接:https://leetcode.com/problems/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,

2016-05-27 17:57:38 229

原创 redis之散列类型

概述我们知道Redis是采用字典结构以键值对的形式存储数据,而散列类型的键值也是一种字典结构,其存储了字段和字段值的映射,但是字段值必须是字符串,不支持其它数据类型,换句话说,散列类型不能嵌套其他数据类型。同时除了散列类型,Redis的其它数据类型同样不支持数据类型嵌套。集合类型的每个元素都只能是字符串,不能是另一个集合或散列表等。散列类型适合存储对象:使用对象类别和ID构成键名,使用字段表示属性,

2016-05-26 16:31:59 622

原创 leetcode 343. Integer Break

题目链接:https://leetcode.com/problems/integer-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 pr

2016-05-26 13:39:02 239

原创 redis中字符串类型

字符串类型是Redis中最基本的数据类型,它能存储任何形式的字符串,包括二进制数据。你可以用其存储用户的手机号,邮箱,Json化后的对象甚至是图片。在ifuchuan类型中键允许存储的数据的最大容量是512MB。 字符串类型是其它4种数据类型的基础,其他数据类型和字符串类型的差别从某种角度来说只是组织字符串的形式不同。例如,列表类型是以列表的形式组织字符串,集合类型是以集合的形式组织字符串。基本命

2016-05-25 12:29:15 318

原创 leetcode319. Bulb Switcher

链接:https://leetcode.com/problems/bulb-switcher/ 题目: There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle ever

2016-05-24 15:53:09 280

原创 leetcode 347.Top K Frequent Elements

链接:https://leetcode.com/problems/top-k-frequent-elements/ 题目: Given a non-empty array of integers, return the k most frequent elements.For example, Given [1,1,1,2,2,3] and k = 2, return [1,2].Note:

2016-05-23 21:29:52 504

原创 redis-对Key的操作

在我们redis中对key的操作是比较频繁也是比较基础的。所以我们当然也要掌握它获取符合规则的键名列表KEYS patternpattern支持glob风格通配符格式,具体规则如下面所示: 符号 含义 ? 匹配一个字符 * 匹配0或者任意个字符 [] 匹配括号间任一字符,可以使用”-“符号表示一个范围,a[b-d]可以匹配ab,ac,ad \x 匹配字符x,用于

2016-05-22 13:02:08 3904

原创 leetcode122. Best Time to Buy and Sell Stock II

题目链接:https://leetcode.com/problems/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 pr

2016-05-22 11:11:50 335

原创 redis-命令返回值

在大多数情况下,执行一条命令后我们往往会关心命令的返回值。命令的返回值有5种类型,对于每种类型redis-cli展现结果都不同。状态回复状态回复(status reply)是最简单的一种回复,比如向Redis发送set命令设置某个键的值时,Redis会回复状态OK表示设置成功。包括ping命令回复PONG也是状态回复。状态回复直接显示状态信息,例子如下:127.0.0.1:6379> set sta

2016-05-21 20:48:20 15556

原创 leetcode:238. Product of Array Except Self

链接:https://leetcode.com/problems/product-of-array-except-self/ 题目: Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the eleme

2016-05-21 12:15:12 260

原创 leetcode 260.Single Number

题目链接:https://leetcode.com/problems/single-number-iii/ 题目: Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two

2016-05-19 17:48:39 265

原创 leetcode 136. Single Number

地址: https://leetcode.com/problems/single-number/ 题目: Given an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear runtime c

2016-05-17 16:44:01 295

原创 leetcode 338. Counting Bits

题目: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and return them as an array.Example: For num = 5 y

2016-05-16 20:55:42 402

原创 每日一题之动归-换钱的最少次数(二)

题目:上一道题是给定一个钱的数组,可以使用任意张数。接下来改变一下题目:给定数组arr,arr中所有的值都是正数。每个值仅代表一张钱的面值,再给定一个整数aim代表要找的钱数,求组成aim的最少货币数。例子: arr=[5,2,3],aim=20。 这里5+2+3=10最大才是10,所以不能组成,返回-1。 arr=[5,2,5,3],aim=10。 这里有两种可能一种是5+5 ,还有一种是

2016-05-15 11:35:54 457

原创 Linux下使用MySql命令详细解析

下载即安装对于下载我们可以去http://dev.mysql.com/downloads下载自己合适的版本,这里我们使用的Ubuntu系统比较方便,只需要简单的几个步骤既可以完成。  1. sudo apt-get install mysql-server  2. sudo apt-get install mysql-client      3. sudo apt-get install li

2016-05-15 10:34:06 788 1

转载 Linux之grep命令

1.作用 Linux系统中grep命令是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹 配的行打印出来。grep全称是Global Regular Expression Print,表示全局正则表达式版本,它的使用权限是所有用户。2.格式 grep [options]3.主要参数 [options]主要参数: -c:只输出匹配行的计数。 -I:不区分大 小写(只适用于单字符)。

2016-05-14 17:04:36 310

原创 每日一题之动归-换钱的最少次数(一)

题目: 给定数组arr,arr中所有的值都为正数且不重复。每个值代表一种面值的货币,每种面值的货币可以使用任意张,再给定一个整数aim代表要找的钱数,求组成aim的最少货币数。 举个例子 arr[5,2,3] ,aim=20 4张5元可以组成20,并且是最小的,所以返回4 arr[5,2,3],aim=0。 不用任何货币就可以组成0元,这里返回0. arr[5,

2016-05-10 17:15:01 1766 1

原创 动态规划-最短排序

题目: 对于一个无序数组A,请设计一个算法,求出需要排序的最短子数组的长度。 给定一个整数数组A及它的大小n,请返回最短子数组的长度。 测试样例: [1,5,3,4,2,6,7],7 结果:4 思路:在O(n)的时间复杂度中可以完成这道题。当然也有利用快排一次然后比较两个不同的个数来求长度。如果使用快排时间复杂度是O(nlogn)。对于O(n)的解法,举个例子[1,5,3,4,2,6,7

2016-05-03 17:17:35 1696 2

原创 Linux之玩转xargs

Man xargs通常我们学习一个命令的时候,我们肯定首先使用man xargs,官方给定的解释是NAME xargs - build and execute command lines from standard input构建并且执行从标准输入(stdin)的命令行。大家应该对管道不陌生吧。我们可以用管道将一个命令的stdout(标准输出)重定向到另一个命令的stdin(标准输入)

2016-05-01 11:56:43 499

空空如也

空空如也

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

TA关注的人

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