LeetCode OJ
数据探险家
专注分享Flink、Hadoop、Spark等大数据及AI技术,爱好原创
展开
-
LeetCode-Validate Binary Search Tree
题目:https://oj.leetcode.com/problems/validate-binary-search-tree/Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtr原创 2014-09-04 20:59:18 · 661 阅读 · 0 评论 -
LeetCode-Binary Tree Postorder Traversal
题目:https://oj.leetcode.com/problems/binary-tree-postorder-traversal/Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3},原创 2014-09-07 21:55:03 · 1070 阅读 · 0 评论 -
LeetCode-Combination Sum II
题目:https://oj.leetcode.com/problems/combination-sum-ii/Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums t原创 2014-09-07 16:35:19 · 1297 阅读 · 0 评论 -
LeetCode-Balanced Binary Tree
题目:https://oj.leetcode.com/problems/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 i原创 2014-09-07 19:41:25 · 1043 阅读 · 0 评论 -
LeetCode-Swap Nodes in Pairs
题目:https://oj.leetcode.com/problems/swap-nodes-in-pairs/Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2原创 2014-09-07 10:34:41 · 982 阅读 · 0 评论 -
LeetCode-Binary Tree Preorder Traversal
题目:https://oj.leetcode.com/problems/binary-tree-preorder-traversal/Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1原创 2014-09-07 21:00:36 · 1033 阅读 · 0 评论 -
LeetCode-Remove Duplicates from Sorted List II
题目:https://oj.leetcode.com/problems/remove-duplicates-from-sorted-list-ii/Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the origina原创 2014-09-07 20:39:52 · 1256 阅读 · 0 评论 -
LeetCode-Binary Tree Level Order Traversal
题目:https://oj.leetcode.com/problems/binary-tree-level-order-traversal/Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For原创 2014-09-07 19:26:05 · 991 阅读 · 0 评论 -
LeetCode-Binary Tree Inorder Traversal
题目:https://oj.leetcode.com/problems/binary-tree-inorder-traversal/Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1原创 2014-09-07 17:05:51 · 2008 阅读 · 0 评论 -
LeetCode-Combination Sum
题目:https://oj.leetcode.com/problems/combination-sum/Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.Th原创 2014-09-07 16:29:55 · 997 阅读 · 0 评论 -
LeetCode-Path Sum II
题目:https://oj.leetcode.com/problems/path-sum-ii/Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree原创 2014-09-07 13:27:57 · 2053 阅读 · 0 评论 -
LeetCode-Interleaving String
题目:https://oj.leetcode.com/problems/interleaving-string/Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example,Given:s1 = "aabcc",s2 = "dbbca",Whe原创 2014-09-07 14:36:13 · 1161 阅读 · 0 评论 -
LeetCode-Word Break
题目:https://oj.leetcode.com/problems/word-break/Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.原创 2014-09-09 21:30:11 · 1641 阅读 · 3 评论 -
LeetCode-Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with原创 2014-08-31 11:04:21 · 638 阅读 · 0 评论 -
LeetCode-Binary Tree Maximum Path Sum
题目:原创 2014-09-01 20:22:13 · 859 阅读 · 0 评论 -
LeetCode-Remove Duplicates from Sorted Array II
题目:Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your function should return length = 5, and A is no原创 2014-08-31 11:40:58 · 768 阅读 · 0 评论 -
LeetCode-Path Sum
题目:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary tree原创 2014-09-01 17:35:05 · 760 阅读 · 0 评论 -
LeetCode-Partition List
题目:https://oj.leetcode.com/problems/partition-list/原创 2014-09-01 21:28:26 · 561 阅读 · 0 评论 -
LeetCode-Minimum Depth of Binary Tree
题目:原创 2014-09-01 20:52:12 · 500 阅读 · 0 评论 -
LeetCode-Unique Binary Search Trees
题目:https://oj.leetcode.com/problems/unique-binary-search-trees/原创 2014-09-01 19:22:59 · 474 阅读 · 0 评论 -
LeetCode-String to Integer (atoi)
题目:https://oj.leetcode.com/problems/string-to-integer-atoi/Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please d原创 2014-09-10 17:56:15 · 1691 阅读 · 0 评论 -
LeetCode-Word Break II
题目:https://oj.leetcode.com/problems/word-break-ii/Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.Return a原创 2014-09-10 11:37:16 · 1199 阅读 · 0 评论 -
LeetCode-Search in Rotated Sorted Array
题目:https://oj.leetcode.com/problems/search-in-rotated-sorted-array/Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2原创 2014-09-04 20:41:31 · 514 阅读 · 0 评论 -
LeetCode-Pow(x, n)
题目:https://oj.leetcode.com/problems/powx-n/原创 2014-09-07 13:16:33 · 804 阅读 · 0 评论 -
LeetCode-Sort Colors
题目:https://oj.leetcode.com/problems/sort-colors/Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order r原创 2014-09-07 13:02:42 · 834 阅读 · 0 评论 -
LeetCode-First Missing Positive
题目:https://oj.leetcode.com/problems/first-missing-positive/Given an unsorted integer array, find the first missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1] retu原创 2014-09-06 11:44:08 · 668 阅读 · 0 评论 -
LeetCode-Evaluate Reverse Polish Notation
题目:Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["原创 2014-09-05 15:47:43 · 531 阅读 · 0 评论 -
LeetCode-Two Sum
题目:https://oj.leetcode.com/problems/two-sum/Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the tw原创 2014-09-05 22:26:59 · 741 阅读 · 0 评论 -
LeetCode-Linked List Cycle
题目:https://oj.leetcode.com/problems/linked-list-cycle/原创 2014-09-05 21:28:44 · 502 阅读 · 0 评论 -
LeetCode-Sort List
题目:https://oj.leetcode.com/problems/sort-list/ort a linked list in O(n log n) time using constant space complexity.分析:原创 2014-09-05 21:03:26 · 752 阅读 · 0 评论 -
LeetCode-Permutations
题目:https://oj.leetcode.com/problems/permutations/Given a collection of numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,原创 2014-09-05 22:08:37 · 637 阅读 · 0 评论 -
LeetCode-Reverse Words in a String
题目:https://oj.leetcode.com/problems/reverse-words-in-a-string/原创 2014-09-05 11:39:30 · 664 阅读 · 0 评论 -
LeetCode-Single Number II
题目:https://oj.leetcode.com/problems/single-number-ii/原创 2014-09-05 10:57:02 · 547 阅读 · 0 评论 -
LeetCode-Single Number
题目:https://oj.leetcode.com/problems/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 runt原创 2014-09-05 10:28:36 · 578 阅读 · 0 评论 -
LeetCode-Subsets II
题目:https://oj.leetcode.com/problems/subsets-ii/原创 2014-09-05 10:21:42 · 667 阅读 · 0 评论 -
LeetCode-3Sum
题目:https://oj.leetcode.com/problems/3sum/原创 2014-09-06 13:06:17 · 1229 阅读 · 2 评论 -
LeetCode-Sum Root to Leaf Numbers
题目:https://oj.leetcode.com/problems/sum-root-to-leaf-numbers/原创 2014-09-06 13:23:46 · 841 阅读 · 0 评论 -
LeetCode-Sqrt(x)
题目:https://oj.leetcode.com/problems/sqrtx/Implement int sqrt(int x).Compute and return the square root of x.分析:erfenchazhao原创 2014-09-06 21:28:55 · 697 阅读 · 0 评论 -
LeetCode-Decode Ways
题目:https://oj.leetcode.com/problems/decode-ways/A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an enc原创 2014-09-06 21:08:22 · 980 阅读 · 0 评论 -
LeetCode-Minimum Path Sum
题目:https://oj.leetcode.com/problems/minimum-path-sum/Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along i原创 2014-09-06 17:01:30 · 645 阅读 · 1 评论