摘要: simplehttpserver python 阅读全文
posted @ 2018-02-12 14:47 繁星苑 阅读(427) 评论(0) 推荐(0) 编辑
摘要: 不能工作的最主要原因为:os x改变了文件存放的路径。因此,需要修改setting中的command的路径,将原来的改为:/usr/local/texlive/2015/bin/x86_64-darwin/pdflatex -synctex=1 -interaction=nonstopmode %.... 阅读全文
posted @ 2015-11-16 13:34 繁星苑 阅读(554) 评论(0) 推荐(0) 编辑
摘要: Single NumberGiven an array of integers, every element appearstwiceexcept for one. Find that single one. def singleNumber(self, A): l = len(... 阅读全文
posted @ 2015-03-28 21:02 繁星苑 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Valid PalindromeGiven a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a pla... 阅读全文
posted @ 2015-03-28 19:02 繁星苑 阅读(188) 评论(0) 推荐(0) 编辑
摘要: Factorial Trailing ZeroesGiven an integern, return the number of trailing zeroes inn!.题目意思:n求阶乘以后,其中有多少个数字是以0结尾的。方法一:class Solution: # @return an i... 阅读全文
posted @ 2015-03-27 15:47 繁星苑 阅读(183) 评论(0) 推荐(0) 编辑
摘要: Pascal's TriangleGivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,... 阅读全文
posted @ 2015-03-27 13:39 繁星苑 阅读(684) 评论(0) 推荐(0) 编辑
摘要: Given an array of sizen, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋times.You may assume that the arr... 阅读全文
posted @ 2015-03-27 10:00 繁星苑 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 最近用来做实验,使用python时发现scikit-learn提供的库非常好用。因此,在电脑上果断下载安装:step1:sudo easy_install pipstep2:sudo pip install -U numpy scipy scikit-learnstep3:测试python -c "... 阅读全文
posted @ 2015-03-17 15:36 繁星苑 阅读(3459) 评论(0) 推荐(0) 编辑
摘要: 两者性能比较(转自http://www.linuxidc.com/Linux/2012-07/66404.htm)本来是知道在Python中使用Set是比较高效,但是没想到竟然有这么大的差距:~$ python -m timeit -n 1000 "[x for x in range(1000) i... 阅读全文
posted @ 2015-03-17 10:27 繁星苑 阅读(37250) 评论(0) 推荐(0) 编辑
摘要: Python的一个很重要的方面就是:函数式编程(functional programming),即可以再原本传递参数和值的地方传递函数。lambda x: x%3 == 0 和以下等价:def by_three(x): return x %3 == 0 我们不需要真的给函数一个名字,其也可... 阅读全文
posted @ 2015-03-02 14:03 繁星苑 阅读(218) 评论(0) 推荐(0) 编辑