- 博客(313)
- 收藏
- 关注
原创 leetcode 486. Predict the Winner
486. Predict the WinnerGiven an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so o
2017-12-04 21:40:21 156
原创 leetcode 329. Longest Increasing Path in a Matrix
329. Longest Increasing Path in a MatrixGiven an integer matrix, find the length of the longest increasing path.From each cell, you can either move to four directions: left, right, up or dow
2017-12-04 21:21:44 143
原创 leetcode 621. Task Scheduler
621. Task SchedulerGiven a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent different tasks.Tasks could be done without original
2017-12-04 15:49:19 306
原创 leetcode 493. Reverse Pairs
493. Reverse PairsGiven an array nums, we call (i, j) an important reverse pair if i and nums[i] > 2*nums[j].You need to return the number of important reverse pairs in the given array.
2017-12-04 14:38:08 255
原创 leetcode 698. Partition to K Equal Sum Subsets
698. Partition to K Equal Sum SubsetsGiven an array of integers nums and a positive integer k, find whether it's possible to divide this array into k non-empty subsets whose sums are all equ
2017-12-04 10:30:04 206
原创 leetcode 687. Longest Univalue Path
687. Longest Univalue PathGiven a binary tree, find the length of the longest path where each node in the path has the same value. This path may or may not pass through the root.Note: The le
2017-12-04 10:01:16 387
原创 leetcode 699. Falling Squares
699. Falling SquaresOn an infinite number line (x-axis), we drop given squares in the order they are given.The i-th square dropped (positions[i] = (left, side_length)) is a square with the left-most p...
2017-12-02 18:23:46 582
原创 leetcode 307. Range Sum Query - Mutable
307. Range Sum Query - MutableGiven 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 updating the element at ...
2017-12-01 10:11:37 162
原创 leetcode 729|731|732. My Calendar 1|2|3
729. My Calendar IImplement a MyCalendar class to store your events. A new event can be added if adding the event will not cause a double booking.Your class will have the method, book(in
2017-11-30 17:14:56 363
原创 leetcode 530. Minimum Absolute Difference in BST
530. Minimum Absolute Difference in BSTGiven a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes.Example:Input: 1
2017-11-30 11:19:06 196
原创 leetcode 399. Evaluate Division
399. Evaluate DivisionEquations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given some queries, re
2017-11-29 23:43:47 177
原创 leetcode 684|685. Redundant Connection 1|2
684. Redundant ConnectionIn this problem, a tree is an undirected graph that is connected and has no cycles.The given input is a graph that started as a tree with N nodes (with distinct valu
2017-11-29 20:18:26 378
原创 leetcode 472. Concatenated Words
472. Concatenated WordsGiven a list of words (without duplicates), please write a program that returns all concatenated words in the given list of words.A concatenated word is defined as a s
2017-11-29 15:12:05 227
原创 leetcode 676. Implement Magic Dictionary
676. Implement Magic DictionaryImplement a magic directory with buildDict, and search methods.For the method buildDict, you'll be given a list of non-repetitive words to build a dictionary
2017-11-29 11:09:45 279
原创 leetcode 677. Map Sum Pairs
677. Map Sum PairsImplement a MapSum class with insert, and sum methods.For the method insert, you'll be given a pair of (string, integer). The string represents the key and the integer re
2017-11-29 10:55:13 193
原创 leetcode 720. Longest Word in Dictionary
720. Longest Word in DictionaryGiven a list of strings words representing an English Dictionary, find the longest word in words that can be built one character at a time by other words in wo
2017-11-29 10:28:59 194
原创 leetcode 648. Replace Words
648. Replace WordsIn English, we have a concept called root, which can be followed by some other words to form another longer word - let's call this word successor. For example, the root an,
2017-11-29 10:04:29 185
原创 leetcode 421. Maximum XOR of Two Numbers in an Array
421. Maximum XOR of Two Numbers in an ArrayGiven a non-empty array of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai < 231.Find the maximum result of ai XOR aj, where 0 ≤ i, j n.Could
2017-11-29 09:40:26 178
原创 leetcode 327. Count of Range Sum
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 betwe
2017-11-29 09:06:14 236
原创 leetcode 315. Count of Smaller Numbers After Self
315. Count of Smaller Numbers After SelfYou 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 of smaller element...
2017-11-28 21:09:03 151
原创 leetcode 282. Expression Add Operators
282. Expression Add OperatorsGiven a string that contains only digits 0-9 and a target value, return all possibilities to add binary operators (not unary) +, -, or * between the digits so th
2017-11-28 20:24:37 231
原创 leetcode 524. Longest Word in Dictionary through Deleting
524. Longest Word in Dictionary through DeletingGiven a string and a string dictionary, find the longest string in the dictionary that can be formed by deleting some characters of the given stri
2017-11-28 15:03:01 215
原创 leetcode 324. Wiggle Sort II
324. Wiggle Sort IIGiven an unsorted array nums, reorder it such that nums[0] < nums[1] > nums[2] < nums[3]....Example:(1) Given nums = [1, 5, 1, 1, 6, 4], one possible answer is [1, 4, 1, 5,...
2017-11-28 11:28:13 216
原创 leetcode 179. Largest Number
179. Largest NumberGiven a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.Note: The resul...
2017-11-28 10:29:27 237
原创 leetcode 164. Maximum Gap
164. Maximum GapGiven an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 if the array contains less than 2 ...
2017-11-28 10:14:53 203
原创 leetcode 502. IPO
502. IPOSuppose LeetCode will start its IPO soon. In order to sell a good price of its shares to Venture Capital, LeetCode would like to work on some projects to increase its capital before th
2017-11-28 10:09:20 329
原创 leetcode 659. Split Array into Consecutive Subsequences
659. Split Array into Consecutive SubsequencesYou are given an integer array sorted in ascending order (may contain duplicates), you need to split them into several subsequences, where each subs
2017-11-28 10:08:52 241
原创 leetcode 692. Top K Frequent Words
692. Top K Frequent WordsGiven a non-empty list of words, return the k most frequent elements.Your answer should be sorted by frequency from highest to lowest. If two words have the same fre
2017-11-28 10:08:21 585
原创 leetcode 719. Find K-th Smallest Pair Distance
719. Find K-th Smallest Pair DistanceGiven an integer array, return the k-th smallest distance among all the pairs. The distance of a pair (A, B) is defined as the absolute difference between A
2017-11-28 10:07:41 1359 2
原创 leetcode 451. Sort Characters By Frequency
451. Sort Characters By FrequencyGiven a string, sort it in decreasing order based on the frequency of characters.Example 1:Input:"tree"Output:"eert"Explanation:'e' appears twice wh
2017-11-27 17:07:07 170
原创 leetcode 373. Find K Pairs with Smallest Sums
373. Find K Pairs with Smallest SumsYou are given two integer arrays nums1 and nums2 sorted in ascending order and an integer k. Define a pair (u,v) which consists of one element from the fi
2017-11-27 16:35:19 120
原创 leetcode 378. Kth Smallest Element in a Sorted Matrix
378. Kth Smallest Element in a Sorted MatrixGiven a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix.Note that it is
2017-11-27 16:26:33 132
原创 leetcode 355. Design Twitter
355. Design TwitterDesign a simplified version of Twitter where users can post tweets, follow/unfollow another user and is able to see the 10 most recent tweets in the user's news feed. Your des
2017-11-27 15:43:06 395
原创 leetcode 295. Find Median from Data Stream
295. Find Median from Data StreamMedian 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 middle val
2017-11-27 15:11:38 258
原创 leetcode 239. Sliding Window Maximum
239. Sliding Window MaximumGiven an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the windo
2017-11-27 14:46:07 165
原创 leetcode 316. Remove Duplicate Letters
316. Remove Duplicate LettersGiven a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your result is the
2017-11-27 14:28:46 221
原创 leetcode 135. Candy
135. CandyThere are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following requirements:Each child must
2017-11-27 10:01:09 111
原创 leetcode 134. Gas Station
134. Gas StationThere are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to tra
2017-11-27 09:57:43 152
原创 leetcode 201. Bitwise AND of Numbers Range
201. Bitwise AND of Numbers RangeGiven a range [m, n] where 0 For example, given the range [5, 7], you should return 4.求公共的2进制前缀。5 - 0101 7 - 01115到7之间的数公共的位就是 0100 -> 4clas
2017-11-27 09:42:20 132
原创 leetcode 190. Reverse Bits 191. Number of 1 Bits
190. Reverse BitsReverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented
2017-11-26 18:37:52 152
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人