Given n non-negative integers a1, a2,
..., an, where each represents a point at coordinate (i, ai). n vertical
lines are drawn such that the two endpoints of line i is at (i, ai) and (i,
0). Fin...
分类:
其他好文 时间:
2015-07-20 19:39:27
阅读次数:
103
What is an eigenvector of a covariance matrix?One of the most intuitive explanations of eigenvectors of a covariance matrix is that they arethe direct...
分类:
其他好文 时间:
2015-07-20 18:47:58
阅读次数:
248
题目如下:
Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop ...
分类:
其他好文 时间:
2015-07-20 16:46:24
阅读次数:
124
math模块、cmath模块floor:向下取整ceil:向上取整sqrt:求平方根>>> import math>>> math.floor(1.1)1>>> math.ceil(1.1)2>>> math.sqrt(1)1.0>>> math.sqrt(-1)Traceback (most re...
分类:
其他好文 时间:
2015-07-20 10:36:42
阅读次数:
124
一.异常 Python遇到错误后会引发异常。若异常对象未被捕捉或处理,程序会回溯(traceback)来终止运行:1 print 1 / 02 3 Traceback (most recent call last):4 File "D:\coding_file\python_file\TestP.....
分类:
编程语言 时间:
2015-07-20 01:21:41
阅读次数:
220
float([x]): 将一个字符串或数转换为浮点数。如果无参数将返回0.0>>> float(12)12.0>>> float(-122)-122.0>>> float('ada')Traceback (most recent call last): File "", line 1, in Va....
分类:
其他好文 时间:
2015-07-19 13:12:21
阅读次数:
154
>>> a122>>> b344>>> c = chr(a)>>> c'z'假如整数“i”超过了256将会爆出一个错误:>>> d = chr(b)Traceback (most recent call last): File "", line 1, in ValueError: chr() ar....
分类:
其他好文 时间:
2015-07-19 13:11:38
阅读次数:
147
题目:
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...
分类:
编程语言 时间:
2015-07-18 15:40:45
阅读次数:
157
1 volley的简单介绍Volley is an HTTP library that makes networking for Android apps easier and most importantly, faster. Volley is available through the open AOSP repository.Volley 是一个HTTP库。它使得android app的网络...
分类:
移动开发 时间:
2015-07-18 00:35:46
阅读次数:
259
看来,我看的教程版本太低了,很多东西都值得推敲。除了小坑print(""),又出现了小坑2input()......>>> x=input("x:")x:2>>> y=input("y:")y:2>>> print("x*y")x*y>>> print(x*y)Traceback (most rec...
分类:
其他好文 时间:
2015-07-17 20:56:19
阅读次数:
118