
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 · 679 阅读 · 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 · 1094 阅读 · 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 · 1315 阅读 · 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 · 1073 阅读 · 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 · 997 阅读 · 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 · 1079 阅读 · 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 · 1278 阅读 · 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 · 1007 阅读 · 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 · 2063 阅读 · 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 · 1018 阅读 · 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 · 2075 阅读 · 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 · 1184 阅读 · 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 · 1668 阅读 · 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 · 654 阅读 · 0 评论 -
LeetCode-Binary Tree Maximum Path Sum
题目:原创 2014-09-01 20:22:13 · 878 阅读 · 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 · 788 阅读 · 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 · 773 阅读 · 0 评论 -
LeetCode-Partition List
题目:https://oj.leetcode.com/problems/partition-list/原创 2014-09-01 21:28:26 · 580 阅读 · 0 评论 -
LeetCode-Minimum Depth of Binary Tree
题目:原创 2014-09-01 20:52:12 · 520 阅读 · 0 评论 -
LeetCode-Unique Binary Search Trees
题目:https://oj.leetcode.com/problems/unique-binary-search-trees/原创 2014-09-01 19:22:59 · 488 阅读 · 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 · 1718 阅读 · 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 · 1226 阅读 · 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 · 533 阅读 · 0 评论 -
LeetCode-Pow(x, n)
题目:https://oj.leetcode.com/problems/powx-n/原创 2014-09-07 13:16:33 · 826 阅读 · 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 · 860 阅读 · 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 · 692 阅读 · 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 · 550 阅读 · 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 · 760 阅读 · 0 评论 -
LeetCode-Linked List Cycle
题目:https://oj.leetcode.com/problems/linked-list-cycle/原创 2014-09-05 21:28:44 · 519 阅读 · 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 · 773 阅读 · 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 · 656 阅读 · 0 评论 -
LeetCode-Reverse Words in a String
题目:https://oj.leetcode.com/problems/reverse-words-in-a-string/原创 2014-09-05 11:39:30 · 683 阅读 · 0 评论 -
LeetCode-Single Number II
题目:https://oj.leetcode.com/problems/single-number-ii/原创 2014-09-05 10:57:02 · 565 阅读 · 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 · 595 阅读 · 0 评论 -
LeetCode-Subsets II
题目:https://oj.leetcode.com/problems/subsets-ii/原创 2014-09-05 10:21:42 · 692 阅读 · 0 评论 -
LeetCode-3Sum
题目:https://oj.leetcode.com/problems/3sum/原创 2014-09-06 13:06:17 · 1248 阅读 · 2 评论 -
LeetCode-Sum Root to Leaf Numbers
题目:https://oj.leetcode.com/problems/sum-root-to-leaf-numbers/原创 2014-09-06 13:23:46 · 856 阅读 · 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 · 717 阅读 · 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 · 1006 阅读 · 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 · 665 阅读 · 1 评论