- 博客(93)
- 资源 (2)
- 收藏
- 关注

原创 python +selenium+phantomjs 登录爬取新浪微博动态js页面
登录新浪微博最近新浪微博好烦,都取消不了验证码这个难搞得东西,而且跳来跳去,一改版以前的代码就都不能用了。目前整理的资料有三种方法: 1. 设Cookie:简单粗暴,免去了模拟登录的好多麻烦,只是要定期更新 2. 模拟登录:验证码是个大麻烦,有把验证码图片截下来,本地识别控制台输入验证 3. 扫码登录 :用app的扫码登录其实除了设cookie ,在有验证码下,后两种方法差不多,都要人工干预
2016-04-14 20:17:15
18877
1

原创 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
2016-03-24 10:39:35
3859
原创 linux基础小计
1. 文件目录常见命令ls -ahl (所有文件包括隐藏,列表方式详细信息,人性化方式) ls 通配符筛选 pwd 查看当前所在文件夹 touch 如果文件不存在,创建文件,若存在,更新文件时间 mkdir -p a/b/c递归创建目录 rm -f 强制,-r 递归 tree 树形图列出目录结构,-d 只显示目录 ...
2018-06-19 21:48:43
390
原创 LaTeX论文写作的一些用法记录
latex公式不编号: \nonumber 常用宏包汇总图片基本用法图片对齐多图片排版表格三线表表格对齐与列宽设置复杂表格结构multirowmulticolumn改变表格行高伪代码一些间距调整特殊符号公式
2018-01-21 20:21:59
1442
原创 使用uncompyle2 反编译pyo
github 地址: wibiti/uncompyle2安装 python setup.py install使用uncompyle2 ***.pyo > ***.py之前做外包也试过加密, 确实有一些加密工具,能通过替换变量名,让代码变得不可读. 但是不管怎样,终归没有完全安全的加密方式….
2017-11-27 14:40:58
1972
原创 ubuntu重装的一些问题
分区1)语言选择英文,建议在Linux系统下一切都使用英文的; 2)先不更新系统、先不安装第三方软件,直接过; 3)选择Something else,把现有分区全部“减”成free space,重新分区如下(大小供参考): /boot:200M,采用Logical Partition,用于efi (注意:如果是双硬盘双系统,可以考虑把该部分放在ssd,与win同一块ssd,否则还需挂载) s
2017-11-26 20:12:00
1043
原创 将二叉搜索树转化为双向链表
输入一棵二叉搜索树,将该二叉搜索树转换成一个排序的双向链表。要求不能创建任何新的结点,只能调整树中结点指针的指向。创建的双向链表的顺序就是二叉搜索树的中序遍历结果。 这里有递归和非递归解法。一般的非递归解法需要开辟额外的空间,本次借助Morris算法,给出一种不需要额外空间开销的非递归解法。 首先是递归 TreeNode lastLeft = null; public Tree
2017-06-20 20:21:37
662
原创 复制含有随机节点的链表
输入一个复杂链表(每个节点中有节点值,以及两个指针,一个指向下一个节点,另一个特殊指针指向任意一个节点),返回结果为复制后复杂链表的head。(注意,输出结果中请不要返回参数中的节点引用,否则判题程序会直接返回空)由于是深copy,随机节点指向的对象也应该是新的节点。 给出两种解法 第一种,采用HashMap记录新旧节点 代码如下: public RandomListNode Clone
2017-06-20 18:25:43
597
原创 剑指offer 二叉树的后续遍历序列
输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果。如果是则输出Yes,否则输出No。假设输入的数组的任意两个数字都互不相同。这题不难,今天想到一个比较好的递归的解法。public class Solution { public boolean VerifySquenceOfBST(int [] sequence) { if(sequence==null || s
2017-06-20 17:06:48
427
原创 剑指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
2017-06-20 10:36:47
407
原创 Java API一些注意的零碎不定期整理
Arrays.binarySearch()二分搜索是建立在有序数组上的,所以搜索前排序,否则得到的结果不可行。指定from, to的时候,包括from,不包括to如果查找到返回对应的位置,没有查找到返回第一个比他大的位置,值为负数,转换后为(-res -1) 不管指定区间与否,3都成立。将集合元素反序Collections.reverse()运行时间在线性范围,但是需要开辟额外的空间。
2017-06-20 09:03:26
595
原创 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' -> 26Given an encoded message containing digits, determine the total number of w
2017-06-11 23:41:16
443
原创 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
2017-06-11 23:16:52
592
原创 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
2017-06-11 20:27:07
370
原创 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 01 0 1 1 11 1 1 1
2017-06-11 17:51:47
434
原创 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
2017-06-11 16:14:43
505
原创 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
2017-06-11 00:19:02
510
原创 leetcode 264. Ugly Number II
Total Accepted: 56978Total Submissions: 176871Difficulty: MediumContributor: LeetCodeWrite a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include
2017-06-10 23:57:24
454
原创 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],
2017-06-10 23:25:43
376
原创 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
2017-06-10 23:04:59
477
原创 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
2017-06-10 21:17:08
482
原创 leetcode 374&375. Guess Number Higher or Lower
We are playing the Guess Game. The game is as follows:I pick a number from 1 to n. You have to guess which number I picked.Every time you guess wrong, I'll tell you whether the number is higher or lowe
2017-06-10 19:40:21
393
原创 leetcode 410. Split Array Largest Sum
Given an array which consists of non-negative integers and an integer m, you can split the array into m non-empty continuous subarrays. Write an algorithm to minimize the largest sum among these m suba
2017-06-10 16:12:38
787
原创 279. 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, retu
2017-06-10 15:07:00
295
原创 leetcode 300. Longest Increasing Subsequence
Given an unsorted array of integers, find the length of longest increasing subsequence.For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest increasing subsequence is [2, 3, 7, 101], therefore t
2017-06-09 23:48:07
299
原创 leetcode 64. Minimum Path Sum
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right at any
2017-06-09 21:29:09
302
原创 leetcode 198. 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 houses
2017-06-09 20:33:18
296
原创 leetcode 309. 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 and
2017-06-09 18:44:00
353
原创 leetcode 62. Unique Paths
A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the botto
2017-06-09 16:59:17
321
原创 leetcode 377. Combination Sum IV 换钱问题
Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target.Example:nums = [1, 2, 3]target = 4The possible com
2017-06-09 16:48:47
713
原创 leetcode 486. Predict the Winner
Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each time a player picks a
2017-06-08 21:23:23
359
原创 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, given n = 2, return 1
2017-06-08 20:16:02
321
原创 leetcode 357. Count Numbers with Unique Digits
Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n.Example:Given n = 2, return 91. (The answer should be the total numbers in the range of 0 ≤ x < 100, excludin
2017-06-08 19:41:39
339
原创 leetcode 413. 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:1,
2017-06-08 17:30:35
292
原创 leetcode 338. Counting Bits
Total Accepted: 76419Total Submissions: 125855Difficulty: MediumContributor: LeetCodeGiven a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1'
2017-06-07 23:19:26
322
原创 leetcode 416. Partition Equal Subset Sum
Given a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal.Note:Each of the array element w
2017-06-07 22:44:44
374
原创 leetcode 392. 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, an
2017-06-07 15:12:30
355
原创 leetcode 53. 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 the
2017-06-07 11:35:07
281
原创 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) -> -1sumRange(0, 5) -
2017-06-07 11:21:49
277
原创 leetcode 121. Best Time to Buy and Sell Stock
Say you have an array for which the ith 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), desi
2017-06-07 10:51:10
319
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人