摘要:
Single NumberGiven an array of integers, every element appearstwiceexcept for one. Find that single one. def singleNumber(self, A): l = len(... 阅读全文
摘要:
Valid PalindromeGiven a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a pla... 阅读全文
摘要:
Factorial Trailing ZeroesGiven an integern, return the number of trailing zeroes inn!.题目意思:n求阶乘以后,其中有多少个数字是以0结尾的。方法一:class Solution: # @return an i... 阅读全文
摘要:
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... 阅读全文
摘要:
两者性能比较(转自http://www.linuxidc.com/Linux/2012-07/66404.htm)本来是知道在Python中使用Set是比较高效,但是没想到竟然有这么大的差距:~$ python -m timeit -n 1000 "[x for x in range(1000) i... 阅读全文