自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

小拳头的博客

临渊羡鱼、不如退而结网

  • 博客(28)
  • 资源 (1)
  • 收藏
  • 关注

原创 scrapy爬取京东商城某一类商品的信息和评论(二)

2、任务二:爬取商品评论信息如果不需要爬取用户的地域信息,那么用这个网址爬就好:http://club.jd.com/review/10321370917-1-1-0.html其中10321370917是商品的ID,评论的第一页就是 -1-1-0.html, 第二页就是-1-2-0.html。之前商品不是存了评论总数吗,一页30个评论,除一下就可以知道多少页了,

2016-07-06 17:48:55 10190 8

原创 scrapy爬取京东商城某一类商品的信息和评论(一)

一、前提默认已用scrapy爬取过网站,有爬虫基础,有爬虫环境二、以爬取电子烟为例1、任务一:爬取商品信息在搜索框里面直接搜索电子烟,搜出来的界面,你会发现它是动态加载的。即一开始源代码里面只能看到30条商品的信息,随着你的下拉,另外30条才会加载出来。因此爬取起来比较麻烦。后来发现,从京东左边的商品分类中找到电子烟这一分类

2016-07-06 17:28:18 27702 13

原创 django遇到css加载不成功的问题

一、问题resource interpreted as stylesheet but transferred with mime type text/html原因:css文件加载不成功二、解决方法将css的文件放在static目录下,static和templates在同一个目录。结构图如下所示:iot_app├── admin.py├── admin

2016-07-29 12:01:47 17149 4

原创 【leetcode】144. 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 / 3return [1,2,3].Note: Recu

2016-07-28 20:09:05 245

原创 【leetcode】94. Binary Tree Inorder Traversal

一、题目描述Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree [1,null,2,3], 1 \ 2 / 3return [1,3,2].Note: Re

2016-07-27 11:09:06 198

原创 【leetcode】319. 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 every third bulb (turning on if it's off or

2016-07-26 20:22:00 295

原创 【leetcode】268. 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 alg

2016-07-26 16:27:41 226

原创 【leetcode】343. 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 product you can get.For example, give

2016-07-26 11:55:01 289

原创 【leetcode】357. Count Numbers with Unique Digits

一、题目描述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 [

2016-07-25 23:38:49 289

原创 【leetcode】347. 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: You may assume k is always valid, 1 ≤

2016-07-24 21:09:54 443

原创 【c++】STL里的priority_queue用法总结

1、头文件#include2、定义priority_queue p;3、优先输出大数据priority_queueType为数据类型, Container为保存数据的容器,Functional为元素比较方式。如果不写后两个参数,那么容器默认用的是vector,比较方式默认用operator例如:#include#includeusin

2016-07-24 20:39:36 87252 13

原创 【leetcode】122. 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

2016-07-21 23:10:03 303

原创 【leetcode】238. 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 elements of nums except nums[i].Solve it without divis

2016-07-20 22:47:49 293

原创 【leetcode】260. 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 elements that appear only once.For exampl

2016-07-20 20:16:03 384

原创 【leetcode】136. 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 complexity. Could you implement it witho

2016-07-19 20:46:44 259

原创 【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:

2016-07-19 20:39:06 300

原创 【leetcode】165. Compare Version Numbers

一、题目描述Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.You may assume that the version strings are non-

2016-07-13 21:14:54 326

原创 【leetcode】189. Rotate Array

一、题目描述Rotate 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 sol

2016-07-13 20:24:30 281

原创 【leetcode】168. Excel Sheet Column Title

一、题目描述Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB

2016-07-12 21:16:19 512

原创 【leetcode】278. First Bad Version

一、题目描述You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed

2016-07-08 16:31:30 363

原创 【leetcode】155. Min Stack

一、题目描述Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.t

2016-07-07 23:16:59 199

原创 【leetcode】7. Reverse Integer

一、题目描述Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thought about this?Here are some good questions to as

2016-07-07 22:38:56 266

原创 【leetcode】125. Valid Palindrome

一、题目描述Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a ca

2016-07-07 00:01:32 378

原创 【leetcode】1. Two Sum

一、题目描述Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution.Example:

2016-07-05 23:35:21 358

原创 【leetcode】204. Count Primes

一、题目描述Description:Count the number of prime numbers less than a non-negative number, n.题目解读:给一个数n,求出比n小的所有质数的总数思路:使用找质数算法之埃拉托色尼筛选法(Sieve of Eratosthenes算法),详细可以查看http://blog.cs

2016-07-03 23:56:18 328

原创 找质数算法之埃拉托色尼筛选法(Sieve of Eratosthenes算法)

一、算法原理一个合数总是可以分解成若干个质数的乘积,那么如果把质数(最初只知道2是质数)的倍数都去掉,那么剩下的就是质数了。二、步骤(1)先把1删除(1既不是质数也不是合数)(2)读取队列中当前最小的数2,然后把2的倍数删去(3)读取队列中当前最小的数3,然后把3的倍数删去(4)读取队列中当前最小的数5,然后把5的倍数删去.......(n)

2016-07-03 23:51:29 11978

原创 【leetcode】303. 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) -> 1sumRange(2, 5)

2016-07-03 23:05:05 332

原创 【leetcode】28. Implement strStr()

一、题目描述Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.题目解读:给你两个字符串needle和haystack,找出needle在haystack第一次出现的下标,

2016-07-01 22:47:32 358

空空如也

空空如也

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

TA关注的人

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