关闭

[置顶] python +selenium+phantomjs 登录爬取新浪微博动态js页面

登录新浪微博最近新浪微博好烦,都取消不了验证码这个难搞得东西,而且跳来跳去,一改版以前的代码就都不能用了。目前整理的资料有三种方法: 1. 设Cookie:简单粗暴,免去了模拟登录的好多麻烦,只是要定期更新 2. 模拟登录:验证码是个大麻烦,有把验证码图片截下来,本地识别控制台输入验证 3. 扫码登录 :用app的扫码登录 其实除了设cookie ,在有验证码下,后两种方法差不多,都要人工干预...
阅读(7743) 评论(2)

[置顶] Spark-1.6.1 Hadoop-2.6.4 VMware Ubuntu 分布式集群搭建 全过程

部分内容参考Hadoop安装教程_单机/伪分布式配置_Hadoop2.6.0/Ubuntu14.04本文从头开始零基础完全配置,适合小白。 本文在vmware中配置三台虚拟机,一台做Master,两台Worker,hadoop 和spark只需要在Master上配置,然后cp到worker上,包括配置文件。Ubuntu基本环境配置创建hadoop用户在终端中输入sudo useradd -m ha...
阅读(1922) 评论(0)

将二叉搜索树转化为双向链表

输入一棵二叉搜索树, 将该二叉搜索树转换成一个排序的双向链表。 要求不能创建任何新的结点,只能调整树中结点指针的指向。创建的双向链表的顺序就是二叉搜索树的中序遍历结果。 这里有递归和非递归解法。一般的非递归解法需要开辟额外的空间,本次借助Morris算法,给出一种不需要额外空间开销的非递归解法。 首先是递归 TreeNode lastLeft = null; public Tree...
阅读(86) 评论(0)

复制含有随机节点的链表

输入一个复杂链表(每个节点中有节点值,以及两个指针,一个指向下一个节点,另一个特殊指针指向任意一个节点),返回结果为复制后复杂链表的head。(注意,输出结果中请不要返回参数中的节点引用,否则判题程序会直接返回空)由于是深copy,随机节点指向的对象也应该是新的节点。 给出两种解法 第一种,采用HashMap记录新旧节点 代码如下: public RandomListNode Clone...
阅读(64) 评论(0)

剑指offer 二叉树的后续遍历序列

输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果。如果是则输出Yes,否则输出No。假设输入的数组的任意两个数字都互不相同。这题不难,今天想到一个比较好的递归的解法。public class Solution { public boolean VerifySquenceOfBST(int [] sequence) { if(sequence==null || s...
阅读(76) 评论(0)

剑指offer 数值的整数次方

给定一个double类型的浮点数base和int类型的整数exponent。求base的exponent次方。写出指数的二进制表达,例如13表达为二进制1101。 举例:10^1101 = 10^0001*10^0100*10^1000。 通过&1和>>1来逐位读取1101,为1时将该位代表的乘数累乘到最终结果。代码public class Solution { public doubl...
阅读(73) 评论(0)

Java API一些注意的零碎不定期整理

Arrays.binarySearch() 二分搜索是建立在有序数组上的,所以搜索前排序,否则得到的结果不可行。 指定from, to的时候,包括from,不包括to 如果查找到返回对应的位置,没有查找到返回第一个比他大的位置,值为负数,转换后为(-res -1) 不管指定区间与否,3都成立。 将集合元素反序Collections.reverse()运行时间在线性范围,但是需要开辟额外的空间。...
阅读(102) 评论(0)

leetcode 91. Decode Ways

A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded message containing digits, determine the total number of w...
阅读(61) 评论(0)

leetcode 523. Continuous Subarray Sum

Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that sums up to the multiple of k, that is, sums up to n...
阅读(66) 评论(0)

leetcode 322. 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 money c...
阅读(68) 评论(0)

leetcode 221. Maximal Square & 85. Maximal Rectangle

221. Maximal SquareGiven a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.For example, given the following matrix:1 0 1 0 0 1 0 1 1 1 1 1 1 1...
阅读(68) 评论(0)

leetcode 139. Word Break

Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words. You may assum...
阅读(66) 评论(0)

leetcode 63. Unique Paths II

Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectively in the grid.For ex...
阅读(63) 评论(0)

leetcode 264. Ugly Number II

Total Accepted: 56978 Total Submissions: 176871 Difficulty: Medium Contributor: LeetCode Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include...
阅读(74) 评论(0)

leetcode 120. Triangle

Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle [ [2], [3,4], [6,5,7],...
阅读(57) 评论(0)

leetcode 213. House Robber II

Note: This is an extension of House Robber.After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time, all...
阅读(62) 评论(0)

leetcode 376. Wiggle Subsequence

A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either posi...
阅读(62) 评论(0)
89条 共6页1 2 3 4 5 ... 下一页 尾页
    个人资料
    • 访问:35769次
    • 积分:1176
    • 等级:
    • 排名:千里之外
    • 原创:86篇
    • 转载:3篇
    • 译文:0篇
    • 评论:5条
    博客专栏
    最新评论