
LeetCode
文章平均质量分 73
杨领well
君子食无求饱,居无求安,敏于事而慎于言,就有道而正焉。
展开
-
LeetCode: 335. Self Crossing
LeetCode: 335. Self Crossing题目描述You are given an array x of n positive numbers. You start at point (0,0) and moves x[0] metres to the north, then x[1] metres to the west, x[2] metres to the south, x...原创 2019-12-02 09:23:33 · 249 阅读 · 0 评论 -
LeetCode: 334. Increasing Triplet Subsequence
LeetCode: 334. Increasing Triplet Subsequence题目描述Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array.Formally the function should:Return true if...原创 2019-11-27 09:18:26 · 165 阅读 · 0 评论 -
LeetCode: 332. Reconstruct Itinerary
LeetCode: 332. Reconstruct Itinerary题目描述Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tickets belo...原创 2019-11-26 09:20:35 · 278 阅读 · 0 评论 -
LeetCode: 331. Verify Preorder Serialization of a Binary Tree
LeetCode: 331. Verify Preorder Serialization of a Binary Tree题目描述One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node’s value. If i...原创 2019-11-25 08:22:20 · 201 阅读 · 0 评论 -
LeetCode: 330. Patching Array
LeetCode: 330. Patching Array题目描述Given a sorted positive integer array nums and an integer n, add/patch elements to the array such that any number in range [1, n] inclusive can be formed by the sum ...原创 2019-11-24 17:28:09 · 228 阅读 · 0 评论 -
LeetCode: 329. Longest Increasing Path in a Matrix
LeetCode: 329. Longest Increasing Path in a Matrix题目描述Given an integer matrix, find the length of the longest increasing path.From each cell, you can either move to four directions: left, right, up...原创 2019-11-22 09:32:47 · 226 阅读 · 0 评论 -
LeetCode: 328. Odd Even Linked List
LeetCode: 328. Odd Even Linked List题目描述Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in...原创 2019-11-21 08:16:16 · 192 阅读 · 0 评论 -
LeetCode: 327. Count of Range Sum
LeetCode: 327. Count of Range SumGiven an integer array nums, return the number of range sums that lie in [lower, upper] inclusive.Range sum S(i, j) is defined as the sum of the elements in nums bet...原创 2019-11-19 08:37:39 · 249 阅读 · 0 评论 -
LeetCode:324. Wiggle Sort II
LeetCode:324. Wiggle Sort II题目描述Given an unsorted array nums, reorder it such that nums[0] < nums[1] > nums[2] < nums[3]…Example 1:Input: nums = [1, 5, 1, 1, 6, 4]Output: One possible an...原创 2019-11-17 08:12:13 · 186 阅读 · 0 评论 -
LeetCode: 322. Coin Change
LeetCode: 322. Coin Change题目描述You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that ...原创 2019-11-13 08:08:10 · 166 阅读 · 0 评论 -
LeetCode: 321. Create Maximum Number
LeetCode: 321. Create Maximum Number题目描述Given two arrays of length m and n with digits 0-9 representing two numbers. Create the maximum number of length k <= m + n from digits of the two. The rel...原创 2019-11-12 08:46:08 · 221 阅读 · 0 评论 -
LeetCode: 319. Bulb Switcher
[LeetCode: 319. Bulb Switcher](LeetCode: 319. Bulb Switcher)题目描述There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, y...原创 2019-11-10 19:41:59 · 216 阅读 · 0 评论 -
LeetCode: 318. Maximum Product of Word Lengths
LeetCode: 318. Maximum Product of Word Lengths题目描述Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may ass...原创 2019-11-09 10:03:42 · 179 阅读 · 0 评论 -
LeetCode: 316. Remove Duplicate Letters
LeetCode: 316. Remove Duplicate Letters题目描述Given a string which contains only lowercase letters, remove duplicate letters so that every letter appears once and only once. You must make sure your res...原创 2019-11-08 09:31:10 · 214 阅读 · 0 评论 -
LeetCode: 315. Count of Smaller Numbers After Self
LeetCode: 315. Count of Smaller Numbers After Self题目描述You are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i] is the number o...原创 2019-11-07 07:45:41 · 180 阅读 · 0 评论 -
LeetCode: 313. Super Ugly Number
LeetCode: 313. Super Ugly NumberWrite a program to find the nth super ugly number.Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes of size k.Exampl...原创 2019-11-06 08:19:51 · 257 阅读 · 0 评论 -
LeetCode: 312. Burst Balloons
LeetCode: 312. Burst Balloons题目描述Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloons. If the you b...原创 2019-11-05 08:08:39 · 202 阅读 · 0 评论 -
LeetCode: 310. Minimum Height Trees
LeetCode: 310. Minimum Height Trees题目描述For an undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree. Among all possible rooted trees,...原创 2019-11-02 10:56:53 · 179 阅读 · 0 评论 -
LeetCode: 309. Best Time to Buy and Sell Stock with Cooldown
LeetCode: 309. Best Time to Buy and Sell Stock with Cooldown题目描述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...原创 2019-10-29 11:23:57 · 141 阅读 · 0 评论 -
LeetCode: 307. Range Sum Query - Mutable
LeetCode: 307. Range Sum Query - Mutable题目描述Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.The update(i, val) function modifies nums by updatin...原创 2019-10-28 19:40:01 · 154 阅读 · 0 评论 -
LeetCode: 306. Additive Number
LeetCode: 306. Additive Number题目描述Additive number is a string whose digits can form additive sequence.A valid additive sequence should contain at least three numbers. Except for the first two numbe...原创 2019-10-26 12:48:45 · 191 阅读 · 0 评论 -
LeetCode: 304. Range Sum Query 2D - Immutable
LeetCode: 304. Range Sum Query 2D - Immutable题目描述Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row...原创 2019-10-25 22:02:30 · 127 阅读 · 0 评论 -
LeetCode: 303. Range Sum Query - Immutable
LeetCode: 303. Range Sum Query - Immutable题目描述Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRa...原创 2019-10-24 13:57:27 · 212 阅读 · 0 评论 -
LeetCode: 301. Remove Invalid Parentheses
LeetCode: 301. Remove Invalid Parentheses题目描述Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results.**Note: **The input string may con...原创 2019-10-24 11:27:57 · 148 阅读 · 0 评论 -
LeetCode: 300. Longest Increasing Subsequence
LeetCode: 300. Longest Increasing Subsequence题目描述Given an unsorted array of integers, find the length of longest increasing subsequence.Example:Input: [10,9,2,5,3,7,101,18]Output: 4 Explanation:...原创 2019-10-23 15:31:06 · 170 阅读 · 0 评论 -
LeetCode: 299. Bulls and Cows
LeetCode: 299. Bulls and Cows题目描述You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend ma...原创 2019-10-23 14:32:33 · 248 阅读 · 0 评论 -
LeetCode: 297. Serialize and Deserialize Binary Tree
LeetCode: 297. Serialize and Deserialize Binary Tree题目描述ShareSerialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memo...原创 2019-10-23 10:26:47 · 180 阅读 · 0 评论 -
LeetCode: 290. Word Pattern
LeetCode: 290. Word Pattern题目描述Given a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection between a letter in pattern and ...原创 2019-10-22 07:18:22 · 151 阅读 · 0 评论 -
LeetCode: 289. Game of Life
LeetCode: 289. Game of Life题目描述According to the Wikipedia’s article: “The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in ...原创 2019-10-21 18:20:27 · 501 阅读 · 0 评论 -
LeetCode: 287. Find the Duplicate Number
LeetCode: 287. Find the Duplicate Number题目描述Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assu...原创 2019-10-21 10:28:36 · 145 阅读 · 0 评论 -
LeetCode:295. Find Median from Data Stream
LeetCode:295. Find Median from Data Stream题目描述Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two m...原创 2019-10-18 18:21:27 · 176 阅读 · 0 评论 -
LeetCode: 37. Sudoku Solver
LeetCode: 37. Sudoku Solver原创 2017-03-28 08:45:23 · 1515 阅读 · 0 评论 -
LeetCode: 41. First Missing Positive
LeetCode: 41. First Missing Positive原创 2017-03-31 10:52:23 · 1497 阅读 · 0 评论 -
LeetCode: 11. Container With Most Water
LeetCode: 11. Container With Most Water原创 2017-03-31 11:44:48 · 1497 阅读 · 0 评论 -
LeetCode: 42. Trapping Rain Water
LeetCode: 42. Trapping Rain Water原创 2017-03-31 11:53:18 · 1705 阅读 · 0 评论 -
LeetCode: 43. Multiply Strings
LeetCode: 43. Multiply Strings原创 2017-04-01 11:00:47 · 923 阅读 · 0 评论 -
LeetCode: 45. Jump Game II
LeetCode: 45. Jump Game II原创 2017-04-01 12:31:22 · 929 阅读 · 0 评论 -
LeetCode: 33. Search in Rotated Sorted Array
LeetCode: 33. Search in Rotated Sorted Array原创 2017-03-26 09:37:13 · 999 阅读 · 0 评论 -
LeetCode: 44. Wildcard Matching
44. Wildcard Matching原创 2017-04-02 15:33:49 · 1346 阅读 · 0 评论 -
LeetCode: 46. Permutations
LeetCode: 46. Permutations原创 2017-04-02 15:50:52 · 594 阅读 · 0 评论