Quantcast
Channel: 书影 - Entries for the tag leetcode
Browsing all 559 articles
Browse latest View live

[LeetCode]Number of Distinct Islands

题目描述:LeetCode 694. Number of Distinct IslandsGiven a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may...

View Article


[LeetCode]Stickers to Spell Word

题目描述:LeetCode 691. Stickers to Spell WordWe are given N different types of stickers. Each sticker has a lowercase English word on it.You would like to spell out the given target string by cutting...

View Article


LeetCode Weekly Contest 53解题报告

LeetCode Weekly Contest 53是LeetCode举办的第五十七场正式周赛,共4道题目,比赛时长1.5小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-53/题解列表:LeetCode 693. Binary Number with Alternating BitsLeetCode 695. Max Area...

View Article

[LeetCode]Top K Frequent Words

题目描述:LeetCode 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...

View Article

[LeetCode]Degree of an Array

题目描述:LeetCode 697. Degree of an ArrayGiven 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...

View Article


[LeetCode]Count Binary Substrings

题目描述:LeetCode 696. Count Binary SubstringsGive a string s, count the number of non-empty (contiguous) substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in these...

View Article

[LeetCode]Partition to K Equal Sum Subsets

题目描述:LeetCode 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...

View Article

[LeetCode]Falling Squares

题目描述:LeetCode 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...

View Article


LeetCode Weekly Contest 54解题报告

LeetCode Weekly Contest 54是LeetCode举办的第五十八场正式周赛,共4道题目,比赛时长1.5小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-54/题解列表:LeetCode 697. Degree of an Array LeetCode 696. Count Binary...

View Article


[LeetCode]Best Time to Buy and Sell Stock with Transaction Fee

题目描述:LeetCode 714. Best Time to Buy and Sell Stock with Transaction FeeYour are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative...

View Article

[LeetCode]Minimum ASCII Delete Sum for Two Strings

题目描述:LeetCode 712. Minimum ASCII Delete Sum for Two StringsGiven two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal.Example 1:Input: s1 = "sea", s2 =...

View Article

[LeetCode]Subarray Product Less Than K

题目描述:LeetCode 713. Subarray Product Less Than KYour are given an array of positive integers nums.Count and print the number of (contiguous) subarrays where the product of all the elements in the...

View Article

[LeetCode]Range Module

题目描述:LeetCode  715. Range ModuleA Range Module is a module that tracks ranges of numbers. Your task is to design and implement the following interfaces in an efficient manner.addRange(int left, int...

View Article


LeetCode Weekly Contest 55解题报告

LeetCode Weekly Contest 55是LeetCode举办的第五十九场正式周赛,共4道题目,比赛时长1.5小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-55/题解列表:LeetCode 714. Best Time to Buy and Sell Stock with Transaction...

View Article

[LeetCode]1-bit and 2-bit Characters

题目描述:LeetCode 717. 1-bit and 2-bit CharactersWe have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11).Now...

View Article


[LeetCode]String Compression

题目描述:LeetCode 443. String CompressionGiven an array of characters, compress it in-place.The length after compression must always be smaller than or equal to the original array.Every element of the...

View Article

[LeetCode]Maximum Length of Repeated Subarray

题目描述:LeetCode 718. Maximum Length of Repeated SubarrayGiven two integer arrays A and B, return the maximum length of an subarray that appears in both arrays.Example 1:Input: A: [1,2,3,2,1] B:...

View Article


[LeetCode]Find K-th Smallest Pair Distance

题目描述:LeetCode 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...

View Article

LeetCode Weekly Contest 56解题报告

LeetCode Weekly Contest 56是LeetCode举办的第六十场正式周赛,共4道题目,比赛时长1.5小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-56/题解列表:LeetCode 717. 1-bit and 2-bit CharactersLeetCode 443. String...

View Article

[LeetCode]Longest Word in Dictionary

题目描述:LeetCode 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...

View Article
Browsing all 559 articles
Browse latest View live