leetcode 93. Restore IP Addresses

题目 Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example: Given “25525511135”, r...

2017-12-20 10:47:05

阅读数 63

评论数 0

LeetCode3. Longest Substring Without Repeating Characters

题目Given a string, find the length of the longest substring without repeating characters.Examples:Given “abcabcbb”, the answer is “abc”, which the len...

2017-11-28 17:40:24

阅读数 277

评论数 0

leetcode110 Balanced Binary Tree

题目Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the de...

2017-05-06 15:35:15

阅读数 176

评论数 0

leetcode257 Binary Tree Paths

题目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 ar...

2017-05-05 21:01:24

阅读数 117

评论数 0

leetcode118 Pascal's Triangle

题目Given numRows, generate the first numRows of Pascal’s triangle.For example, given numRows = 5, Return[ [1], [1,1], [1,2,1], [1,3,3,1...

2017-05-05 15:27:51

阅读数 127

评论数 0

leetcode413 Arithmetic Slices

题目A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is t...

2017-04-08 15:15:41

阅读数 313

评论数 0

leetcode538 Convert BST to Greater Tree

题目Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of a...

2017-04-05 20:31:24

阅读数 573

评论数 0

LeetCode202 Happy Number

题目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 inte...

2017-02-20 21:50:48

阅读数 128

评论数 0

LeetCode13 Roman to Integer

题目Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.解题思路罗马数字的规则参考这个。 总结起来就是如果前一位数字大于后一位,就加上其...

2017-02-19 14:55:37

阅读数 144

评论数 0

LeetCode409 Longest Palindrome

题目Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.Th...

2017-02-16 21:27:26

阅读数 158

评论数 0

LeetCode169 Majority Element

题目Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that t...

2017-02-16 19:51:09

阅读数 133

评论数 0

LeetCode242 Valid Anagram

题目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...

2017-02-16 12:58:49

阅读数 146

评论数 0

LeetCode171 Excel Sheet Column Number

题目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 A...

2017-02-15 21:40:05

阅读数 183

评论数 0

LeetCode387 First Unique Character in a String

题目Given a string, find the first non-repeating character in it and return it’s index. If it doesn’t exist, return -1.Examples:s = “leetcode” return ...

2017-02-15 17:19:35

阅读数 149

评论数 0

LeetCode349 Intersection of Two Arrays

原题Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. Note: Each e...

2017-02-14 21:27:36

阅读数 205

评论数 0

取消 删除