技术学习
文章平均质量分 63
sscssz
这个作者很懒,什么都没留下…
展开
-
一个简单的不用cookie的人人网状态爬取的python爬虫,使用beautifulsoup
昨天晚上闲着无聊翻翻人人,想来过去几年一直用的人人,里面好多喜怒哀乐。正好最近在写爬虫,干脆把它都弄下来留着吧。于是开工。爬取的是我自己的全部已经发过的状态。先是,向所有人一样,百度了一下,有没有现成的解决方案,确实有不少,说要先登录,然后再保留cookie,然后再用什么正则表达式,好是麻烦。然后登录人人,分析它的网页结构,还是挺麻烦的,状态的界面都是用ajax原创 2015-11-21 14:57:54 · 2176 阅读 · 0 评论 -
208. Implement Trie (Prefix Tree)【58】【M】
Implement a trie with insert, search, and startsWith methods.Note:You may assume that all inputs are consist of lowercase letters a-z.Subscribe to see which companies asked this原创 2016-05-27 16:06:59 · 259 阅读 · 0 评论 -
150. Evaluate Reverse Polish Notation【M】【19】
Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "1",原创 2016-05-17 13:02:43 · 393 阅读 · 0 评论 -
【word2vec】之 训练模型结果的结构探究 模型改造 python gensim
word2vec的安装,应用帖子好多,那如果想在训练的结果,也就是得到的向量上做点儿文章,该如何呢下面来说说word2vec(python的gensim包)训练得到的模型,以及得到的向量是什么样子的因为python训练得到的结果是二进制的,说白了就是乱码,现在既然想得到整个结果,该怎么弄呢。其实好多事情直接看源码就能得到。之前试图找api或者小伙伴的帖子,想看看原创 2016-07-15 22:19:42 · 6996 阅读 · 0 评论 -
【Github教程】史上最全github使用方法:github入门到精通
原文 http://www.eoeandroid.com/thread-274556-1-1.html【初识Github】首先让我们大家一起喊一句“Hello Github”。YEAH!就是这样。Git是一个分布式的版本控制系统,最初由Linus Torvalds编写,用作Linux内核代码的管理。在推出后,Git在其它项目中也取得了很大成功,尤其是在Ruby社区中。目前,转载 2016-07-27 15:50:22 · 1624 阅读 · 0 评论 -
【leetcode】404. Sum of Left Leaves【E】
Find the sum of all left leaves in a given binary tree.Example: 3 / \ 9 20 / \ 15 7There are two left leaves in the binary tree, with values 9 and 15 respectively. Return 24原创 2016-09-26 21:23:25 · 1298 阅读 · 0 评论 -
【leetcode】382. Linked List Random Node【M】【74】
Given a singly linked list, return a random node's value from the linked list. Each node must have the same probability of being chosen.Follow up:What if the linked list is extremely large and i原创 2016-11-04 21:41:09 · 407 阅读 · 0 评论 -
401. Binary Watch【E】
A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59).Each LED represents a zero or one, with the least significant bit o原创 2016-11-05 19:49:04 · 405 阅读 · 0 评论 -
【leetcode】423. Reconstruct Original Digits from English【M】【95】
Given a non-empty string containing an out-of-order English representation of digits 0-9, output the digits in ascending order.Note:Input contains only lowercase English letters.Input is g原创 2016-10-28 14:29:41 · 467 阅读 · 0 评论 -
【leetcode】【M】406. Queue Reconstruction by Height【95】
Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the person and k is the number of people in front of t原创 2016-11-09 14:10:22 · 362 阅读 · 0 评论 -
【索引 index】是个好东西——大幅加快MySQL update更新速度的方法
去年这个时候,也是做数据库操作其中,是对主键为字符串的大概几万条的数据进行更新,就已经很慢了语句类似于这样:UPDATE persondata SET age=age+1 where name = '伏地魔';因为要全库去找,字符串比较,速度很慢,大概一秒钟几条,如果数据一行很长的话,可能会更慢忽然想起来,是不是可以建个索引然后就试着建了个索引,当点save的那原创 2016-12-14 17:09:40 · 24392 阅读 · 1 评论 -
GloVe 教程之实战入门+python gensim 词向量
前几天看论文,忽然看到了一个跟word2vec并列的词向量工具,这么厉害?还能跟word2vec相提并论?果断需要试试。GloVe 它来自斯坦福的一篇论文,GloVe全称应该是 Global Vectors for Word Representation官网在此 http://nlp.stanford.edu/projects/glove/原创 2016-11-25 13:20:17 · 43528 阅读 · 8 评论 -
109. Convert Sorted List to Binary Search Tree【M】【33】【leetcode题解】
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.Subscribe to see which companies asked this question从给定的有序链表生成平衡二叉树。解原创 2016-02-23 15:24:41 · 410 阅读 · 0 评论 -
326. Power of Three【E】【81】
Given an integer, write a function to determine if it is a power of three.Follow up:Could you do it without using any loop / recursion?Credits:Special thanks to @dietpepsi for adding this原创 2016-02-14 15:35:52 · 409 阅读 · 0 评论 -
mysql数据库操作缓慢,原来是字段的内容过长导致的,看来cache很有用.报错:Lock wait timeout exceeded; try restarting transaction
最近在对一个大概二十万条的数据进行多线程查找修改等操作。本来运行的好好地一个程序,忽然改了一下之后就变得极慢无比。看了一下,主要是卡在数据库的操作上。刚开始还以为机器开得太久,于是使用重启大法,结果,依旧没用。之前大概每秒钟至少一条的速度,现在大概每分钟就只有几条。而且一直报错:Lock wait timeout exceeded; try rest原创 2015-11-23 17:22:20 · 1234 阅读 · 0 评论 -
Plus One【leetcode】【89】【E】
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.class Solution原创 2015-11-18 22:19:42 · 344 阅读 · 0 评论 -
【leetcode】【40%】【M】Remove Duplicates from Sorted Array II
Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array nums = [1,1,1,2,2,3],Your function should return length = 5, with the first fi原创 2015-11-19 16:48:25 · 411 阅读 · 0 评论 -
共享文件夹—— 一个实现Mac与PC互传文件,维护同一个文件夹简单的方法
屋子里一个台式机,一个Mac,经常需要传文件。之前要么是用qq,要么用网盘,要么用U盘or移动硬盘。虽然有点儿麻烦,但是一直懒得研究有什么简便方法。昨天觉得这么整实在太low了,哪像一个搞计算机的,实在忍不了了,开始研究。先是用Mac上的共享,然后文件夹共享,AFP和SMB,研究了一会儿发现pc连不上。当然,其实能用一些个软件架个ftp服务器,就是嫌麻烦。于是,给出下面原创 2015-11-26 16:40:06 · 22324 阅读 · 0 评论 -
mysql 一条update语句实现两个表数据合并
实现两个表的数据合并。比如,有全校所有人的09年的成绩,现在想把10年的某一科的成绩添加进去。其实很简单,一条语句就能搞定。当然了,实现的方法有太多。这里说一个update语句的。UPDATE table1,table2SET table1.field1 = table2.fiedl2WHERE table1.id = table2.id;原创 2015-11-26 21:29:57 · 7605 阅读 · 0 评论 -
【特别重要!!!快排的partition思想】【leetcode题解】【M】【71】Kth Largest Element in an Array
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given [3,2,1,5,6,4] and k = 2, return 5.原创 2015-12-13 20:10:09 · 1579 阅读 · 0 评论 -
【E】【87】【leetcode】Factorial Trailing Zeroes
Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.Credits:Special thanks to @ts for adding this problem and creating原创 2015-11-28 16:39:10 · 395 阅读 · 0 评论 -
【34.7】【H】【leetcode】Trapping Rain Water
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Given [0,1,0,2,1,0,1,3,2,1,2,1]原创 2015-11-28 15:43:26 · 453 阅读 · 0 评论 -
【92】【H】【leetcode】 Search in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the array retur原创 2015-12-06 21:03:43 · 443 阅读 · 0 评论 -
java实现126邮箱邮件发送,使用stmp协议
用java实现一个简单的发送邮件的程序。比较烦人的是,好多邮箱都需要手机验证才能开启stmp服务。跑程序之前记得看一下,邮箱的stmp是否开启,否则会报java 发送邮件报异常 javax.mail.AuthenticationFailedException: 550 ???§±????¨的错误原创 2015-12-07 14:40:33 · 3308 阅读 · 0 评论 -
328. Odd Even Linked List[E][86]【leetcode】
Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.You should try to do it in原创 2016-02-14 15:20:08 · 378 阅读 · 0 评论 -
【LeetCode】126. Word Ladder II【H】
Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord to endWord, such that:Only one letter can be changed at a timeEac原创 2017-04-02 14:23:26 · 837 阅读 · 0 评论