- 博客(63)
- 收藏
- 关注
原创 【python3】leetcode 90. Subsets II (Medium)
90. Subsets II (Medium)Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets....
2018-12-27 23:26:07 180
原创 【python3】leetcode 840. Magic Squares In Grid(easy)
840. Magic Squares In Grid(easy)A 3 x 3 magic square is a 3 x 3 grid filled with distinct numbers from 1 to 9such that each row, column, and both diagonals all have the same sum.Given an grid of ...
2018-12-27 21:20:08 212
原创 【python3】leetcode 825. Friends Of Appropriate Ages (Medium)
825. Friends Of Appropriate Ages (Medium)Some people will make friend requests. The list of their ages is given and ages[i] is the age of the ith person. Person A will NOT friend request person B...
2018-12-27 11:48:43 296
原创 【python3】leetcode 162. Find Peak Element (Medium)
162. Find Peak Element (Medium)A peak element is an element that is greater than its neighbors.Given an input array nums, where nums[i] ≠ nums[i+1], find a peak element and return its index.The...
2018-12-26 17:14:17 144
原创 【python3】leetcode 900. RLE Iterator (Medium)
900. RLE Iterator (Medium)Write an iterator that iterates through a run-length encoded sequence.The iterator is initialized by RLEIterator(int[] A), where A is a run-length encoding of some seque...
2018-12-26 11:09:18 110
原创 【python3】leetcode 495. Teemo Attacking (Medium)
495. Teemo Attacking (Medium)In LOL world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned condition. Now, given the Teemo's attacking ascending time series to...
2018-12-26 09:14:59 137
原创 【python3】leetcode 961. N-Repeated Element in Size 2N Array(easy)
961. N-Repeated Element in Size 2N Array(easy)In a array A of size 2N, there are N+1 unique elements, and exactly one of these elements is repeated N times.Return the element repeated N times. ...
2018-12-25 14:37:52 256
原创 【python3】leetcode 75. Sort Colors (Medium)
75. Sort Colors (Medium)Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white and blue...
2018-12-25 08:32:02 125
原创 【python3】leetcode 895. Maximum Frequency Stack(Hard)
895. Maximum Frequency Stack(Hard)Implement FreqStack, a class which simulates the operation of a stack-like data structure.FreqStack has two functions:push(int x), which pushes an integer x on...
2018-12-23 10:18:12 226
原创 【python3】leetcode 748. Shortest Completing Word(easy)
748. Shortest Completing Word(easy)Find the minimum length word from a given dictionary words, which has all the letters from the string licensePlate. Such a word is said to complete the given stri...
2018-12-22 21:40:14 168
原创 【python3】leetcode 648. Replace Words (Medium)
648. Replace Words (Medium) In 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 ...
2018-12-21 08:55:40 141
原创 【python3】leetcode 451. Sort Characters By Frequency (Medium)
451. Sort Characters By Frequency (Medium)Given a string, sort it in decreasing order based on the frequency of characters.Example 1:Input:"tree"Output:"eert"Explanation:'e' appears twi...
2018-12-21 00:14:51 162
原创 【python3】leetcode 599. Minimum Index Sum of Two Lists(easy)
599. Minimum Index Sum of Two Lists(easy)Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings.You need to help t...
2018-12-20 23:14:27 142
原创 【python3】leetcode 347. Top K Frequent Elements(Medium)
347. Top K Frequent Elements(Medium)Given a non-empty array of integers, return the k most frequent elements.Example 1:Input: nums = [1,1,1,2,2,3], k = 2Output: [1,2]Example 2:Input: nu...
2018-12-20 19:59:08 291 1
原创 【python3】leetcode 594. Longest Harmonious Subsequence(easy)
594. Longest Harmonious Subsequence(easy)We define a harmonious array is an array where the difference between its maximum value and its minimum value is exactly 1.Now, given an integer array, yo...
2018-12-20 17:20:23 165 1
原创 【python3】leetcode 350. Intersection of Two Arrays II(easy)
350. Intersection of Two Arrays II(easy)Given two arrays, write a function to compute their intersection.Example 1:Input: nums1 = [1,2,2,1], nums2 = [2,2]Output: [2,2]Example 2:Input: n...
2018-12-20 16:57:23 138
原创 【python3】leetcode 204. Count Primes (easy)
204. Count Primes (easy)Count the number of prime numbers less than a non-negative number, n.Example:Input: 10Output: 4Explanation: There are 4 prime numbers less than 10, they are 2, 3, 5, ...
2018-12-20 16:47:41 206
原创 【python3】leetcode 781. Rabbits in Forest (medium)
781. Rabbits in Forest (medium)In a forest, each rabbit has some color. Some subset of rabbits (possibly all of them) tell you how many other rabbits have the same color as them. Those answers are ...
2018-12-20 00:48:02 188
原创 【python3】leetcode 389. Find the Difference (easy)
389. Find the Difference (easy)Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter at a random posit...
2018-12-20 00:17:45 207
原创 【python3】leetcode 205. Isomorphic Strings (easy)
205. Isomorphic Strings (easy)Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a charact...
2018-12-19 20:34:09 233
原创 【python3】leetcode 219. Contains Duplicate II(easy)
219. Contains Duplicate II(easy)Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolute diffe...
2018-12-19 19:46:31 161
原创 【python3】leetcode 575. Distribute Candies(easy)
575. Distribute CandiesGiven an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of the corresponding kind. Yo...
2018-12-19 17:57:40 113
原创 【python3】leetcode 771. Jewels and Stones(easy)
771. Jewels and StonesYou're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to...
2018-12-19 17:25:10 209
原创 【python3】leetcode 811. Subdomain Visit Count(easy)
811. Subdomain Visit Count(easy)A website domain like "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcode.com", and at the l...
2018-12-19 17:04:44 195
原创 【python3】leetcode 387. First Unique Character in a String(easy)
387. First Unique Character in a String(easy)Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.Examples:s = "leetcode"return 0...
2018-12-19 15:43:04 162 1
原创 【python3】leetcode 953. Verifying an Alien Dictionary (easy)
953. Verifying an Alien Dictionary (easy)In an alien language, surprisingly they also use english lowercase letters, but possibly in a different order. The order of the alphabet is some permutation...
2018-12-19 15:02:32 311
原创 【python3】leetcode 884. Uncommon Words from Two Sentences (easy)
884. Uncommon Words from Two Sentences (easy) We are given two sentences A and B. (A sentence is a string of space separated words. Each word consists only of lowercase letters.)A word is unco...
2018-12-19 10:34:34 175
原创 【python3】leetcode 706. Design HashMap (easy)
706. Design HashMap (easy)Design a HashMap without using any built-in hash table libraries.To be specific, your design should include these functions:put(key, value) : Insert a (key, value) pai...
2018-12-19 00:19:03 147
原创 【python3】leetcode 705. Design HashSet(easy)
705. Design HashSet(easy)Design a HashSet without using any built-in hash table libraries.To be specific, your design should include these functions:add(value): Insert a value into the HashSet....
2018-12-19 00:06:43 191
原创 【python3】leetcode 136. Single Number (easy)
136. Single Number (easy)Given a non-empty array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could...
2018-12-18 21:49:05 124
原创 【python3】leetcode 561. Array Partition I (easy)
561. Array Partition I (easy)Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) for al...
2018-12-17 10:38:17 149
原创 【python3】leetcode 697. Degree of an Array(easy)
697. Degree of an Array(easy)Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements.Your task is to find th...
2018-12-16 17:30:48 182
原创 【python3】leetcode 605. Can Place Flowers(easy)
605. Can Place Flowers(easy)Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they would compete for ...
2018-12-16 16:47:15 270
原创 【python3】leetcode 628. Maximum Product of Three Numbers(easy)
628. Maximum Product of Three Numbers(easy)Given an integer array, find three numbers whose product is maximum and output the maximum product.Example 1:Input: [1,2,3]Output: 6 Example 2:...
2018-12-16 15:48:51 165
原创 【python3】leetcode 581. Shortest Unsorted Continuous Subarray(easy)
581. Shortest Unsorted Continuous Subarray(easy)Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will b...
2018-12-16 15:18:17 248
原创 【python3】leetcode 566. Reshape the Matrix(easy)
566. Reshape the Matrix(easy) In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data.You're given a ...
2018-12-14 23:02:31 95
原创 【python3】leetcode 941. Valid Mountain Array(easy)
941. Valid Mountain Array(easy) Given an array A of integers, return true if and only if it is a valid mountain array.Recall that A is a mountain array if and only if:A.length >= 3 There ex...
2018-12-14 16:47:56 170
原创 【python3】leetcode 832. Flipping an Image(easy)
832. Flipping an Image(easy)Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resulting image.To flip an image horizontally means that each row of th...
2018-12-14 16:11:48 107
原创 【python3】leetcode 867. Transpose Matrix (easy)
867. Transpose Matrix Given a matrix A, return the transpose of A.The transpose of a matrix is the matrix flipped over it's main diagonal, switching the row and column indices of the matrix. ...
2018-12-14 15:59:03 138
原创 【python3】leetcode 922. Sort Array By Parity II (easy)
922. Sort Array By Parity II (easy)Given an array A of non-negative integers, half of the integers in A are odd, and half of the integers are even.Sort the array so that whenever A[i] is odd, i i...
2018-12-14 14:45:15 199
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人