原创 20170606-leetcode-581-Shortest Unsorted Continuous Subarray

1.Description Given an integer array, you need to find one continuous subarray that if you only sort this subarray

原创 20170611-leetcode-041-First Missing Positive

1.Description Given an unsorted integer array, find the first missing positive integer. For example, Given [1,2,0

原创 201705031-leetcode-155-Min Stack

1.Description Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. pus

原创 python爬蟲獲取豆瓣正在熱播電影

熱播地址:https://movie.douban.com/cinema/nowplaying/beijing/ 1、使用瀏覽器查看html文件 找到熱播電影的標籤文件 查看tag,可以看到最開始的tag爲li 2、HTMLPas

原创 20170630-leetcode-225 Implement Stack using Queues

1.Description Implement the following operations of a stack using queues. - push(x) – Push element x onto stack.

原创 20170529-leetcode-582-Kill process

1.Description Given n processes, each process has a unique PID (process id) and its PPID (parent process id). Each

原创 Window10+Python3.5安裝opencv

1.確定Python版本,電腦64位或者32位 打開cmd(window鍵+R,輸入cmd就出現),在命令行輸入:打開cmd(window鍵+R,輸入cmd就出現),在命令行輸入:python Python 3.5.2 |Anac

原创 20170604-leetcode-460-LFU Cache

1.Description Design and implement a data structure for Least Frequently Used (LFU) cache. It should support the fo

原创 20170612-leetcode-575-Distribute Candies

Given an integer array with even length, where different numbers in this array represent different kinds of candies

原创 20170605-leetcode-532-K-diff Pairs in an Array

1.Description Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in th

原创 Pyton爬蟲實現豆瓣登陸

目標:實現豆瓣登陸; 方法:使用requests.Session 來處理cookies 問題:驗證碼輸入 關於headers 1.實現登陸 # -*- coding: utf-8 -*- import requests f

原创 20170603-leetcode-560-Subarray Sum Equals K

1.Description Given an array of integers and an integer k, you need to find the total number of continuous subarray

原创 20170602-leetcode-211-Add and Search Word - Data structure design

1.Description Design a data structure that supports the following two operations: void addWord(word) bool search(w

原创 Python 正則表達

1.match和search的區別 def re_method(): # search vs. Match s = 'abcd' print(re.search(r'c', s)) print(re.match(r'c', s))

原创 20170403-leetcode-349/50-Intersection of Two Arrays.py

兩個同類型的題:349/350. 349:1、2;350:3,4 1.Description Given two arrays, write a function to compute their intersection.