随笔分类 -  Leetcode

摘要:题目:反转字符串 Write a function that takes a string as input and returns the string reversed. Example:Given s = "hello", return "olleh". 五种解法: 耗时56ms 耗时52ms 阅读全文
posted @ 2016-08-26 22:56 python挖掘 阅读(272) 评论(0) 推荐(0) 编辑
摘要:Write a function that takes a string as input and reverse only the vowels of a string. Example 1: Given s = "hello", return "holle". Example 2: Given 阅读全文
posted @ 2016-04-24 20:25 python挖掘 阅读(313) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr 阅读全文
posted @ 2016-04-21 21:51 python挖掘 阅读(158) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the 阅读全文
posted @ 2016-03-15 21:52 python挖掘 阅读(135) 评论(0) 推荐(0) 编辑
摘要:Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 阅读全文
posted @ 2016-03-15 21:51 python挖掘 阅读(292) 评论(0) 推荐(0) 编辑
摘要:Given a column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 阅读全文
posted @ 2016-03-15 19:40 python挖掘 阅读(151) 评论(0) 推荐(0) 编辑
摘要:Given two strings s and t, write a function to determine if t is an anagram of s. For example, s = "anagram", t = "nagaram", return true. s = "rat", t 阅读全文
posted @ 2016-03-15 19:25 python挖掘 阅读(290) 评论(0) 推荐(0) 编辑
摘要:倒置二叉树答案: 递归方法 # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = 阅读全文
posted @ 2016-03-07 19:31 python挖掘 阅读(161) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, find its maximum depth.求二叉树的最大深度 The maximum depth is the number of nodes along the longest path from the root node down to the f 阅读全文
posted @ 2016-03-07 19:23 python挖掘 阅读(93) 评论(0) 推荐(0) 编辑
摘要:Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For exa 阅读全文
posted @ 2016-02-26 19:33 python挖掘 阅读(173) 评论(0) 推荐(0) 编辑
摘要:Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive intege 阅读全文
posted @ 2016-02-26 19:08 python挖掘 阅读(363) 评论(0) 推荐(0) 编辑
摘要:Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 阅读全文
posted @ 2016-02-26 18:29 python挖掘 阅读(158) 评论(0) 推荐(0) 编辑
摘要:You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 ston 阅读全文
posted @ 2016-02-26 18:20 python挖掘 阅读(221) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示