- 博客(28)
- 收藏
- 关注
原创 LeetCode:Longest Common Prefix
class Solution: # @return a string def longestCommonPrefix(self, strs): if strs==[]: return '' else: l=len(strs[0]) base=strs[0]
2014-10-21 18:57:48 334
原创 LeetCode:Merge Sorted Array
You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements from B. The number of elements initialized in A and B are m andn respectively.
2014-10-20 19:10:01 361
原创 LeetCode:Divide Two Integers
Divide two integers without using multiplication, division and mod operator.
2014-10-18 01:09:42 447
原创 LeetCode:Single Number II
class Solution: # @param A, a list of integer # @return an integer def singleNumber(self, A): l=[] x=0 minus=0 for i in range(32): l.append(0)
2014-10-16 17:28:33 297
原创 LeetCode:Reverse Words in a String
class Solution: # @param s, a string # @return a string def reverseWords(self, s): s=s.split() s.reverse() s=' '.join(s) return s
2014-10-15 23:47:59 577
原创 LeetCode:Minimum Depth of Binary Tree
Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
2014-10-15 23:46:44 295
原创 LeetCode:Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),
2014-10-15 16:10:48 286
原创 LeetCode:Same Tree
# Definition for a binary tree node# class TreeNode:# def __init__(self, x):# self.val = x# self.left = None# self.right = Noneclass Solution: # @param p, a tre
2014-10-15 16:08:34 288
原创 LeetCode:Maximum Depth of Binary Tree
# Definition for a binary tree node# class TreeNode:# def __init__(self, x):# self.val = x# self.left = None# self.right = Noneclass Solution: # @param root, a
2014-10-15 16:06:14 312
原创 LeetCode:Sqrt(x)
Implement int sqrt(int x).Compute and return the square root of x.二分查找方法,
2014-10-15 15:58:50 277
原创 LeetCode:Single Number
Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using e
2014-10-15 15:57:59 279
原创 Python宝典第16章:Python与数据库
PythonWin中的odbc模块提供了对ODBC的支持。PythonWin中的dbi模块定义le
2014-10-04 11:09:27 583
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人