LeetCode
文章平均质量分 58
shangyj17
这个作者很懒,什么都没留下…
展开
-
LeetCode-128. Longest Consecutive Sequence-python3代码+解题思路
0.原题:Given an unsorted array of integers, find the length of the longest consecutive elements sequence.Your algorithm should run in O(n) complexity.Input: [100, 4, 200, 1, 3, 2]Output: 4Expla...原创 2018-09-09 17:51:26 · 316 阅读 · 0 评论 -
LeetCode-55. Jump Game
0.原题Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine...原创 2018-10-18 22:17:51 · 128 阅读 · 0 评论 -
LeetCode-122. Best Time to Buy and Sell Stock II
0.原题Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i.e., ...原创 2018-10-18 20:58:57 · 285 阅读 · 0 评论 -
LeetCode-38. Count and Say
0.原题The count-and-say sequence is the sequence of integers with the first five terms as following:1. 12. 113. 214. 12115. 1112211 is read off as "one 1" or 11.11 is rea...原创 2018-10-18 17:39:19 · 92 阅读 · 0 评论 -
LeetCode-121. Best Time to Buy and Sell Stock
0.原题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 (i.e., buy one and sell one share of the s...原创 2018-10-18 16:21:03 · 114 阅读 · 0 评论 -
LeetCode-39. Combination Sum
0.原题Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target.The same ...原创 2018-09-28 22:15:21 · 155 阅读 · 0 评论 -
LeetCode-198. House Robber
0.原题You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent...原创 2018-10-06 19:00:31 · 146 阅读 · 0 评论 -
LeetCode-130. Surrounded Regions
0.原题Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region.Example:X X X X...原创 2018-10-04 14:38:22 · 112 阅读 · 0 评论 -
LeetCode-200. Number of Islands
0.原题Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may ...原创 2018-10-03 21:58:37 · 201 阅读 · 0 评论 -
LeetCode-37. Sudoku Solver
0.原题Write a program to solve a Sudoku puzzle by filling the empty cells.A sudoku solution must satisfy all of the following rules:Each of the digits 1-9 must occur exactly once in each row. Eac...原创 2018-10-02 22:30:45 · 82 阅读 · 0 评论 -
LeetCode-17. Letter Combinations of a Phone Number
0.原题Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) ...原创 2018-10-01 23:20:38 · 103 阅读 · 0 评论 -
LeetCode-51.N-Queens
0.原题The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the n-queens puzzle...原创 2018-10-01 10:36:05 · 89 阅读 · 0 评论 -
LeetCode-236. Lowest Common Ancestor of a Binary Tree-python3代码+解题思路
0.原题:Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two n...原创 2018-09-10 16:21:07 · 496 阅读 · 0 评论 -
LeetCode-45. Jump Game II
0.原题Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your goal...原创 2018-10-21 13:26:49 · 134 阅读 · 0 评论