随笔分类 -  Python

摘要:Problem Definition:Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.Solution:要求把所有存在an... 阅读全文
posted @ 2015-08-04 20:56 曾可爱 阅读(107) 评论(0) 推荐(0)
摘要:Problem Definition:Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily lar... 阅读全文
posted @ 2015-08-04 16:58 曾可爱 阅读(158) 评论(0) 推荐(0)
摘要:Problem Definition:Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.Solution:就是要用加减和位操作之类... 阅读全文
posted @ 2015-08-01 20:38 曾可爱 阅读(159) 评论(0) 推荐(0)
摘要:1)a是引用,指向(标注)一段连续的内存区域,内容是 1,2 b是引用,指向一段连续的内存区域,内容是另一个引用。后者指向当时a所指向的东西,也就是那块内容为1,2的内存区域。 a被重定向,指向另一个内存区域,内容是4,52)a是引用,指向(标注)一段连续的内存区域,内容是 1,2 b是引用,指向... 阅读全文
posted @ 2015-07-31 11:04 曾可爱 阅读(206) 评论(0) 推荐(0)
摘要:Problem Definition:Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just l... 阅读全文
posted @ 2015-07-30 14:53 曾可爱 阅读(139) 评论(0) 推荐(0)
摘要:Problem Definition:Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the strin... 阅读全文
posted @ 2015-07-23 22:14 曾可爱 阅读(105) 评论(0) 推荐(0)
摘要:Problem Definition:Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100".Solution: crack it in a ... 阅读全文
posted @ 2015-07-23 20:15 曾可爱 阅读(130) 评论(0) 推荐(0)
摘要:Problem Definiton:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note:You may assume that nums1 has enou... 阅读全文
posted @ 2015-07-23 11:08 曾可爱 阅读(115) 评论(0) 推荐(0)
摘要:Problem Definition:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a... 阅读全文
posted @ 2015-07-21 11:33 曾可爱 阅读(105) 评论(0) 推荐(0)
摘要:Problem Definition: Compare two version numbers version1 and version2. If version1 > version2 return 1, if version1 f2 else (-1 if f1b a=[1] b=[0,2... 阅读全文
posted @ 2015-07-20 14:49 曾可爱 阅读(131) 评论(0) 推荐(0)
摘要:Problem Definition: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. Y... 阅读全文
posted @ 2015-07-19 22:21 曾可爱 阅读(157) 评论(0) 推荐(0)
摘要:Problem Definition: Given a column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C ->... 阅读全文
posted @ 2015-07-19 19:56 曾可爱 阅读(114) 评论(0) 推荐(0)
摘要:Problem Definition:Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 0000001010010100000111... 阅读全文
posted @ 2015-07-18 14:58 曾可爱 阅读(127) 评论(0) 推荐(0)
摘要:Problem Definition:Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For ex... 阅读全文
posted @ 2015-07-18 14:13 曾可爱 阅读(151) 评论(0) 推荐(0)
摘要:Problem Definition: Given an array of integers and an integer k, find out whether there there are two distinct indices i and j in the array such tha... 阅读全文
posted @ 2015-07-16 20:32 曾可爱 阅读(142) 评论(0) 推荐(0)
摘要:Problem Definition: Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5,7], return ["0-... 阅读全文
posted @ 2015-07-16 11:45 曾可爱 阅读(167) 评论(0) 推荐(0)
摘要:here 阅读全文
posted @ 2015-07-03 09:12 曾可爱 阅读(125) 评论(0) 推荐(0)
摘要:Closures In PythonEntirely copied from here All I want is to mark it, thanks for this nice article.You might have lived a long and happy coding life w... 阅读全文
posted @ 2015-06-30 11:40 曾可爱 阅读(204) 评论(0) 推荐(0)