自定义博客皮肤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)
  • 收藏
  • 关注

原创 binary tree

class Node: def __init__(self, value = None,left = None, right = None): self.value = value self.left = left self.right = right#recursiondef preTraverse(root): if root == None: return prin

2017-07-20 15:21:37 197

原创 binary search【leetcode34,35,74,240】

一、模板题目:A = [1,2,3,3,4]target = 3<<<output = 2返回A中与target相等的第一个元素的位置#key points:#start + 2 < end#start + (end - start)/2#A[mid] ==.#A[start] A[end] ? target#适用范围:可以转换为first/last position o

2017-07-13 22:17:05 198

原创 hash去重及应用-【leetcode219-Contains Duplicate II】

一、题目Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolute difference between i and j 

2017-07-11 17:04:23 249

原创 pascal三角原理+zip用法-【leetcode119-pascal triangle2】

一、题目Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm to use only O(k) extra space?二、渣渣

2017-07-11 15:24:10 305

原创 二维数组的生成-【leetcode118- Pascal's Triangle 】

一、题目Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]二、解法2.1 渣渣法一

2017-07-08 00:27:40 210

原创 字符串可以按位获得和列表生成式-【leetcode66-plus one】

一、题目Given a non-negative integer represented as a non-empty array of digits, plus one to the integer.You may assume the integer do not contain any leading zero, except the number 0 itself.

2017-07-07 00:54:55 294

原创 leetcode35-search insert position

1、渣渣渣法一:耗时226ms,beats 0.02%class Solution(object): def searchInsert(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """

2017-07-04 12:00:40 170

转载 python set() 函数-leetcode217 contains duplicate

1、set()函数python的set和其他语言类似, 是一个无序不重复元素集, 基本功能包括关系测试和消除重复元素. 集合对象还支持union(联合), intersection(交), difference(差)和sysmmetric difference(对称差集)等数学运算.    sets 支持 x in set, len(set),和 for x in set。

2017-07-04 10:56:35 680

转载 python值和引用——【LeetCode】RotateArray

Rotate ArrayRotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to[5,6,7,1,2,3,4].Note:Try to come up as many

2017-07-04 00:53:18 241

原创 scrapy win7(64bit) python2.7(64 bit)安装

我之前安了半天,还倒腾了anaconda,结果发现自己python是32位,anaconda安的64位。后来又倒腾倒腾,结果玩坏了,干脆重新开始。首先,因为已经玩坏了,干脆把之前的python删掉,包括环境变量也要删掉。然后再从官网上下最新的python2.7.13(64bit),安装好以后添加环境变量。第二,下载pywin32.exe,安装的时候如果无法显示python所

2017-04-06 00:27:37 485

原创 python基本爬虫实现

血泪史:编好以后一直出现 HTTPConnectionPool(host='dds.cr.usgs.gov',port=80): Max retries exceeded with url: 报错,错误代码是11104,看到博客上说是没有找到匹配的网址,我可能当时眼睛瞎了吧,没看出来,试了各种办法。终于一行一行比对代码后看出来是我太粗心打错网址了。。我真的是。。一、模块1、re

2017-01-13 01:29:59 250

原创 python 试验7 简单抽奖程序

一、实验内容1.奖池中电话号码通过文件输入,文件中每一行一个电话号码;2.在控制台中每 100 毫秒在新行输出一个电话号码,模拟滚动效果;3.用户单击回车键,停止滚动,输出中奖号码。4.命令行:python lucky.py filenamea) lucky.py 为编写的 Python 代码文件;b) filename 为奖池文件的路径;c) 程序执行结果输出到控制台

2016-04-22 18:59:53 2662

原创 python 实验6 字符串练习(二)

一、实验要求字符串 a = "aAsmr3idd4bgs7Dlsf9eAF"1.请将 a 字符串的数字取出,并输出成一个新的字符串。2.请统计 a 字符串出现的每个字母的出现次数(忽略大小写,a 与 A 是同一个字母),并输出成一个字典。 例 {'a':3,'b':1}3.请去除 a 字符串多次出现的字母,仅留最先出现的一个,大小写不敏感。例'aAsmr3idd4bgs7D

2016-04-21 19:32:28 8832

原创 python 实验5 字符串练习(一)

一、要求1.实验内容已知一个文件 test.txt,内容如下:------------------2012 来了。2012 不是世界末日。2012 欢乐多。------------------1.请输出其内容。2.请计算该文本的原始长度。3.请去除该文本的换行。4.请替换其中的字符"2012"为"2015"。5.请提取内容为数字的子串(2012,20

2016-04-21 16:23:41 1708

原创 数据结构 C语言 严蔚敏版 算法2.1

//已知线性表La和Lb的数据元素按值非递减有序排列,现要求将La和Lb归并为一个新的线性表Lc,且Lc中的数据元素仍按值非递减有序排列。#include #include #include int main(){    int i=0,j=0,k=0,La_len,Lb_len,Lc_len;    char La[]={3,5,8,11};

2016-04-18 21:41:49 1724

原创 openssl win7安装及应用于code blocks

写在前面:小白中的小白,只是想记录一下自己安装openssl的心酸历史,如有不对望指出,谢谢各大神。环境:win7,64位一、准备工作1.安装Active Perl2.下载openssl:在官网上即可下载,我下载的是openssl-0.9.8zh版本二、安装步骤1.安装Active Perl    运行CMD指令,使用cd命令进入Active Perl安

2016-01-15 21:07:54 1961

空空如也

空空如也

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

TA关注的人

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