LeetCode解题报告
文章平均质量分 80
LeetCode题目思路分析,解题报告
哎-哭泣的鱼
这个作者很懒,什么都没留下…
展开
-
【LeetCode】236 Lowest Common Ancestor of a Binary Tree
Lowest Common Ancestor of a Binary TreeTotal Accepted: 1207 Total Submissions: 4143 My Submissions Question Solution Given a binary tree, find the lowest common ancestor (LCA) of two given nodes i原创 2015-07-13 17:51:14 · 1588 阅读 · 0 评论 -
【LeetCode】235 Lowest Common Ancestor of a Binary Search Tree
Lowest Common Ancestor of a Binary Search TreeTotal Accepted: 3808 Total Submissions: 9820 My Submissions Question Solution Given a binary search tree (BST), find the lowest common ancestor (LCA)原创 2015-07-13 17:39:13 · 1106 阅读 · 0 评论 -
【LeetCode】234 Palindrome Linked List
Palindrome Linked ListTotal Accepted: 1116 Total Submissions: 4295 My Submissions Question Solution Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n原创 2015-07-10 16:33:05 · 3664 阅读 · 0 评论 -
【LeetCode】Basic Calculator && Basic Calculator II
1、Basic Calculator Total Accepted: 3726 Total Submissions: 24053 My Submissions Question Solution Implement a basic calculator to evaluate a simple expression string.The expression string may co原创 2015-06-24 11:01:51 · 3971 阅读 · 0 评论 -
【LeetCode】Maximal Rectangle && Maximal Square
1、Maximal Rectangle Total Accepted: 24875 Total Submissions: 113379 My Submissions Question Solution Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all o原创 2015-06-05 17:56:28 · 1173 阅读 · 0 评论 -
【LeetCode】Minimum Size Subarray Sum
Minimum Size Subarray Sum Total Accepted: 5312 Total Submissions: 22940 My Submissions Question Solution Given an array of n positive integers and a positive integer s, find the minimal length of原创 2015-06-02 11:03:09 · 762 阅读 · 0 评论 -
【LeetCode】Number of Islands
Number of Islands Total Accepted: 8945 Total Submissions: 41107 My Submissions Question Solution Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surr原创 2015-06-02 09:28:51 · 816 阅读 · 0 评论 -
【LeetCode】Rising Temperature
Rising Temperature Total Accepted: 2437 Total Submissions: 8879 My Submissions Question Solution Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared原创 2015-05-26 09:36:51 · 708 阅读 · 0 评论 -
【LeetCode】Intersection of Two Linked Lists
1、【LeetCode】Intersection of Two Linked Lists Total Accepted: 16034 Total Submissions: 58142 My Submissions Question Solution Write a program to find the node at which the intersection of two singl原创 2015-02-13 16:26:10 · 795 阅读 · 0 评论 -
【LeetCode】Sudoku Solver
Sudoku Solver Total Accepted: 20609 Total Submissions: 96910 My Submissions Question Solution Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the原创 2015-02-04 22:54:52 · 843 阅读 · 0 评论 -
【LeetCode】Valid Sudoku
Valid Sudoku Total Accepted: 25228 Total Submissions: 92921 My Submissions Question Solution Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be pa原创 2015-02-04 18:12:29 · 819 阅读 · 0 评论 -
【LeetCode】Largest Rectangle in Histogram
Largest Rectangle in Histogram Total Accepted: 26683 Total Submissions: 120953 My Submissions Question Solution Given n non-negative integers representing the histogram's bar height where the widt原创 2015-01-27 18:58:12 · 1116 阅读 · 0 评论 -
【LeetCode】Department Highest Salary && Department Top Three Salaries
1、Department Highest SalaryTotal Accepted: 367 Total Submissions: 1887 My Submissions Question Solution The Employee table holds all employees. Every Employee has an Id, a salary, and there is原创 2015-01-27 10:51:04 · 1288 阅读 · 0 评论 -
【LeetCode】Min Stack && 【九度】题目1522:包含min函数的栈
1、【LeetCode】Min StackMin StackTotal Accepted: 15869 Total Submissions: 102810 My Submissions Question Solution Design a stack that supports push, pop, top, and retrieving the minimum element in原创 2015-01-24 21:13:36 · 802 阅读 · 0 评论 -
【LeetCode】Second Highest Salary && Nth Highest Salary
1、Second Highest Salary Total Accepted: 1030 Total Submissions: 4309 My Submissions Question Solution Write a SQL query to get the second highest salary from the Employee table.+----+--------+|原创 2015-01-16 14:12:37 · 3430 阅读 · 6 评论 -
【LeetCode】Largest Number
Largest Number Total Accepted: 2369 Total Submissions: 15947 My Submissions Question Solution Given a list of non negative integers, arrange them such that they form the largest number.For examp原创 2015-01-16 10:05:03 · 3145 阅读 · 0 评论 -
【LeetCode】Maximum Product Subarray
Total Accepted: 7579 Total Submissions: 47716 My Submissions Question Solution Find the contiguous subarray within an array (containing at least one number) which has the largest product.For examp原创 2014-10-17 11:33:43 · 687 阅读 · 0 评论 -
【LeetCode】Remove Element
Remove ElementTotal Accepted: 27425 Total Submissions: 82536 My Submissions Question Solution Given an array and a value, remove all instances of that value in place and return the new length.Th原创 2014-10-16 18:08:44 · 593 阅读 · 0 评论 -
【LeetCode】Length of Last Word
Length of Last Word Total Accepted: 20470 Total Submissions: 69655 My SubmissionsGiven a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last w原创 2014-10-10 17:38:26 · 645 阅读 · 0 评论 -
【LeetCode】Jump Game && Jump Game II
1、Jump GameTotal Accepted: 17703 Total Submissions: 65204 My SubmissionsGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the原创 2014-08-27 15:05:52 · 1142 阅读 · 0 评论 -
【LeetCode】Maximum Subarray
Maximum Subarray Total Accepted: 20964 Total Submissions: 62498 My SubmissionsFind the contiguous subarray within an array (containing at least one number) which has the largest sum.For example,原创 2014-08-07 18:15:50 · 667 阅读 · 0 评论 -
【LeetCode】Add Two Numbers
Add Two Numbers Total Accepted: 17137 Total Submissions: 75794 My SubmissionsYou are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each o原创 2014-07-17 15:53:10 · 696 阅读 · 0 评论 -
【LeetCode】Merge k Sorted Lists
Merge k Sorted Lists Total Accepted: 13489 Total Submissions: 61228 My SubmissionsMerge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.【解题思路】1、参考Me原创 2014-07-16 15:09:38 · 810 阅读 · 0 评论 -
【LeetCode】Merge Two Sorted Lists
Merge Two Sorted Lists Total Accepted: 18308 Total Submissions: 55982 My SubmissionsMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the原创 2014-07-15 10:24:50 · 800 阅读 · 0 评论 -
【LeetCode】Validate Binary Search Tree
Validate Binary Search Tree Total Accepted: 15264 Total Submissions: 60008 My SubmissionsGiven a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follo原创 2014-07-11 11:16:52 · 895 阅读 · 0 评论 -
【LeetCode】Pascal's Triangle II
Pascal's Triangle II Accepted: 11888 Total Submissions: 39509 My SubmissionsGiven an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Cou原创 2014-07-04 18:50:19 · 2277 阅读 · 2 评论 -
【LeetCode】Pascal's Triangle
Pascal's Triangle Total Accepted: 13674 Total Submissions: 43141 My SubmissionsGiven numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1]原创 2014-07-04 16:59:58 · 686 阅读 · 0 评论 -
【LeetCode】Multiply Strings
Multiply Strings Total Accepted: 9184 Total Submissions: 45371 My SubmissionsGiven two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be a原创 2014-07-04 10:23:56 · 677 阅读 · 0 评论 -
【LeetCode】Spiral Matrix II
Spiral Matrix II Total Accepted: 9622 Total Submissions: 31755 My SubmissionsGiven an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n原创 2014-07-03 11:47:37 · 1039 阅读 · 0 评论 -
【LeetCode】Spiral Matrix
Spiral Matrix Total Accepted: 9568 Total Submissions: 47010 My SubmissionsGiven a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Gi原创 2014-07-03 10:58:35 · 1034 阅读 · 0 评论 -
【LeetCode】Add Binary
Add Binary Total Accepted: 11726 Total Submissions: 45895 My SubmissionsGiven two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".【解题思路】原创 2014-07-02 17:37:10 · 892 阅读 · 0 评论 -
【LeetCode】Palindrome Number
Palindrome Number Total Accepted: 13733 Total Submissions: 47166 My SubmissionsDetermine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Cou原创 2014-06-09 17:24:56 · 626 阅读 · 0 评论 -
【LeetCode】Clone Graph
Clone Graph Total Accepted: 8986 Total Submissions: 41904 My SubmissionsClone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph seria原创 2014-05-08 13:29:35 · 695 阅读 · 0 评论 -
【LeetCode】Binary Tree Postorder Traversal 二叉树后序遍历递归以及非递归算法
Binary Tree Postorder Traversal Total Accepted: 15614 Total Submissions: 50928 My SubmissionsGiven a binary tree, return the postorder traversal of its nodes' values.For example:Given binary t原创 2014-05-07 18:31:28 · 1387 阅读 · 0 评论 -
【LeetCode】Binary Tree Inorder Traversal 二叉树中序遍历递归以及非递归算法
Binary Tree Inorder Traversal Total Accepted: 16494 Total Submissions: 47494Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3},原创 2014-05-07 18:21:16 · 1327 阅读 · 0 评论 -
【LeetCode】Binary Tree Preorder Traversal 二叉树前序遍历递归以及非递归算法
Binary Tree Preorder Traversal Total Accepted: 17403 Total Submissions: 50093 My SubmissionsGiven a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tre原创 2014-05-07 17:14:12 · 782 阅读 · 0 评论 -
【LeetCode】Trapping Rain Water
Trapping Rain Water Total Accepted: 8428 Total Submissions: 30087 My SubmissionsGiven n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water原创 2014-05-07 12:20:08 · 675 阅读 · 0 评论 -
【LeetCode】Evaluate Reverse Polish Notation
Evaluate Reverse Polish Notation Total Accepted: 11741 Total Submissions: 60315 My SubmissionsEvaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -,原创 2014-05-06 17:46:00 · 689 阅读 · 0 评论 -
【LeetCode】Count and Say
Count and Say Total Accepted: 7984 Total Submissions: 30169 My SubmissionsThe count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off原创 2014-05-06 14:43:56 · 1802 阅读 · 0 评论 -
【LeetCode】Word Ladder
Word Ladder Total Accepted: 9317 Total Submissions: 53652 My SubmissionsGiven two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, su原创 2014-05-05 13:28:44 · 779 阅读 · 0 评论