
leetcode
文章平均质量分 54
annalittlezhou
前进路上的伪码农一枚
展开
-
leetcode in python 543
Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longestpath between any two nodes in a tree. This path may or may no...原创 2018-03-28 23:18:49 · 337 阅读 · 0 评论 -
leetcode in python 680
Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome.Example 1:Input: "aba"Output: TrueExample 2:Input: "abca"Output: TrueExplanation: You c...原创 2018-03-31 00:31:28 · 417 阅读 · 0 评论 -
leetcode in python 121
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), des...原创 2018-03-31 00:10:34 · 523 阅读 · 0 评论 -
leetcode in python 67
Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".关键词:对列表中的元素进行类型转换并连接时间自由度:O(n)# 2016-03-27 294 tests, 64 msclass Solution(object): def a...原创 2018-03-02 20:37:11 · 363 阅读 · 0 评论 -
leetcode in python 283
Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after calling your func...原创 2018-02-27 21:52:16 · 244 阅读 · 0 评论 -
leetcode in python 257
Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are:["1->2->5", "1->3"]关键词:二叉树,节点类型时间自由度:O(nlo...原创 2018-03-07 11:27:09 · 362 阅读 · 0 评论 -
leetcode in python 278
You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the...原创 2018-03-07 10:46:21 · 216 阅读 · 0 评论 -
leetcode in python 1
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same el...原创 2018-02-26 18:19:35 · 200 阅读 · 0 评论 -
leetcode in python 125
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a palindro...原创 2018-03-28 23:23:49 · 247 阅读 · 0 评论