python编程
放狼的爷们
阳光 儒雅 博学 勤思 死宅
展开
-
Keyboard Row
class Solution(object): def findWords(self, words): """ :type words: List[str] :rtype: List[str] """ rows = [set(['q', 'w', 'e', 'r', 't', 'y','u', 'i原创 2017-07-04 23:35:22 · 215 阅读 · 0 评论 -
hamming distance
class Solution(object): def hammintDistance(self,x,y): distance = 0 z = x^y while z: distance += 1 z &= z -1 return distance while原创 2017-06-26 23:45:42 · 218 阅读 · 0 评论 -
Reshape the Matrix
class Solution(object): def matrixReshape(self, nums, r, c): """ :type nums: List[List[int]] :type r: int :type c: int :rtype: List[List[int]] """原创 2017-07-06 00:04:18 · 142 阅读 · 0 评论 -
Array Partition I
class Solution(object): def arrayPairSum(self, nums): """ :type nums: List[int] :rtype: int """ result = 0 nums.sort(); for i in range(0,len原创 2017-06-27 20:57:03 · 187 阅读 · 0 评论 -
Number Complement
class Solution(object): def findComplement(self, num): """ :type num: int :rtype: int """ flag = 0 for i in range(31,-1,-1): if (num & (原创 2017-06-28 00:21:56 · 242 阅读 · 0 评论 -
Python3.6 IDLE常用快捷键
安装IDLE后鼠标右键点击*.py 文件,可以看到Edit with IDLE 选择这个可以直接打开编辑器。 IDLE默认不能显示行号,使用ALT+G 跳到对应行号,在右下角有显示光标所在行、列。 ALT+P,上一个历史输入内容,ALT+N 下一个历史输入内容。 IDLE中按F5可以运行代码。 编辑状态时: Ctrl + [ 、Ctrl + ] 缩进代码 Alt+3 Alt+4转载 2017-05-06 22:57:59 · 8051 阅读 · 0 评论