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

Image may be NSFW.
Clik here to view.

[LeetCode]Trapping Rain Water II

题目描述:LeetCode 407. Trapping Rain Water IIGiven an m x n matrix of positive integers representing the height of each unit cell in a 2D elevation map, compute the volume of water it is able to trap after...

View Article


LeetCode Weekly Contest 6解题报告

LeetCode Weekly Contest 6是LeetCode举办的第五场正式周赛,共4道题目,比赛时长2.5小时。比赛链接:https://leetcode.com/contest/detail/6题解列表:LeetCode 404. Sum of Left LeavesLeetCode 405. Convert a Number to HexadecimalLeetCode 406....

View Article


[LeetCode]Valid Word Abbreviation

题目描述:LeetCode 408. Valid Word AbbreviationGiven a non-empty string s and an abbreviation abbr, return whether the string matches with the given abbreviation.A string such as "word" contains only the...

View Article

[LeetCode]Longest Palindrome

题目描述:LeetCode 409. Longest PalindromeGiven a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.This is case...

View Article

[LeetCode]Split Array Largest Sum

题目描述:LeetCode 410. Split Array Largest SumGiven an array which consists of non-negative integers and an integer m, you can split the array into m non-empty continuous subarrays. Write an algorithm to...

View Article


[LeetCode]Minimum Unique Word Abbreviation

题目描述:LeetCode 411. Minimum Unique Word AbbreviationA string such as "word" contains the following abbreviations: ["word", "1ord", "w1rd", "wo1d", "wor1", "2rd", "w2d", "wo2", "1o1d", "1or1", "w1r1",...

View Article

LeetCode Weekly Contest 7解题报告

LeetCode Weekly Contest 7是LeetCode举办的第六场正式周赛,共4道题目,比赛时长2.5小时。比赛链接:https://leetcode.com/contest/detail/7题解列表:LeetCode 408. Valid Word AbbreviationLeetCode 409. Longest PalindromeLeetCode 410. Split...

View Article

[LeetCode]Add Strings

题目描述:LeetCode 415. Add StringsIMPORTANT:Solutions which uses a BigInteger library or converting the input strings to another type (such as integer) will result in disqualification of all submissions to...

View Article


[LeetCode]Partition Equal Subset Sum

题目描述:LeetCode 416. Partition Equal Subset SumGiven a non-empty array containing only positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both...

View Article


[LeetCode]Pacific Atlantic Water Flow

题目描述:LeetCode 417. Pacific Atlantic Water FlowGiven an m x n matrix of non-negative integers representing the height of each unit cell in a continent, the "Pacific ocean" touches the left and top edges...

View Article

[LeetCode]Sentence Screen Fitting

题目描述:LeetCode 418. Sentence Screen FittingGiven a rows x cols screen and a sentence represented by a list of words, find how many times the given sentence can be fitted on the screen.Note:A word cannot...

View Article

LeetCode Weekly Contest 8解题报告

LeetCode Weekly Contest 8是LeetCode举办的第七场正式周赛,共4道题目,比赛时长2.5小时。比赛链接:https://leetcode.com/contest/detail/8题解列表:LeetCode 415. Add StringsLeetCode 416. Partition Equal Subset SumLeetCode 417. Pacific...

View Article

[LeetCode]Fizz Buzz

题目描述:LeetCode 412. Fizz BuzzWrite a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and for the multiples...

View Article


[LeetCode]Arithmetic Slices

题目描述:LeetCode 413. Arithmetic SlicesA sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.For...

View Article

[LeetCode]Third Maximum Number

题目描述:LeetCode 414. Third Maximum NumberGiven an array of integers, return the 3rd Maximum Number in this array, if it doesn't exist, return the Maximum Number. The time complexity must be O(n) or...

View Article


[LeetCode]Battleships in a board

题目描述:LeetCode 419. Battleships in a boardGiven an 2D board, count how many different battleships are in it. The battleships are represented with 'X's, empty slots are represented with '.'s. You may...

View Article

[LeetCode]Maximum XOR of Two Numbers in an Array

题目描述:LeetCode 421. Maximum XOR of Two Numbers in an ArrayGiven a list of numbers, a[0], a[1], a[2], … , a[N-1], where 0 <= a[i] < 2^32. Find the maximum result of a[i] XOR a[j].Could you do this...

View Article


[LeetCode]Valid Word Square

题目描述:LeetCode 422. Valid Word SquareGiven a sequence of words, check whether it forms a valid word square.A sequence of words forms a valid word square if the kth row and column read the exact same...

View Article

[LeetCode]Reconstruct Original Digits from English

题目描述:LeetCode 423. Reconstruct Original Digits from EnglishGiven a non-empty string containing an out-of-order English representation of digits 0-9, output the digits in ascending order.Note:Input...

View Article

[LeetCode]Longest Repeating Character Replacement

题目描述:LeetCode 424. Longest Repeating Character ReplacementGiven a string that consists of only uppercase English letters, you can replace any letter in the string with another letter at most k times....

View Article
Browsing all 559 articles
Browse latest View live