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

[LeetCode]Ones and Zeroes

题目描述:LeetCode 474. Ones and ZeroesIn the computer world, use restricted resource you have to generate maximum benefit is what we always want to pursue.For now, suppose you are a dominator of m0s and...

View Article


[LeetCode]Encode String with Shortest Length

题目描述:LeetCode 471. Encode String with Shortest LengthGiven a non-empty string, encode the string such that its encoded length is the shortest.The encoding rule is: k[encoded_string], where the...

View Article


LeetCode Weekly Contest 12解题报告

LeetCode Weekly Contest 12是LeetCode举办的第十五场正式周赛,共4道题目,比赛时长2小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-12/题解列表:LeetCode 475. HeatersLeetCode 468. Validate IP AddressLeetCode 474. Ones...

View Article

[LeetCode]Hamming Distance

题目描述:LeetCode 461. Hamming DistanceThe Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Hamming...

View Article

[LeetCode]Total Hamming Distance

题目描述:LeetCode 477. Total Hamming DistanceThe Hamming distance between two integers is the number of positions at which the corresponding bits are different.Now your job is to find the total Hamming...

View Article


[LeetCode]Matchsticks to Square

题目描述:LeetCode 473. Matchsticks to SquareRemember the story of Little Match Girl? By now, you know exactly what matchsticks the little match girl has, please find out a way you can make one square by...

View Article

[LeetCode]Concatenated Words

题目描述:LeetCode 472. Concatenated WordsGiven a list of words, please write a program that returns all concatenated words in the given list of words.A concatenated word is defined as a string that is...

View Article

LeetCode Weekly Contest 13解题报告

LeetCode Weekly Contest 13是LeetCode举办的第十六场正式周赛,共4道题目,比赛时长2小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-13/题解列表:LeetCode 461. Hamming DistanceLeetCode 477. Total Hamming DistanceLeetCode...

View Article


[LeetCode]Largest Palindrome Product

题目描述:LeetCode 479. Largest Palindrome ProductFind the largest palindrome made from the product of two n-digit numbers.Since the result could be very large, you should return the largest palindrome mod...

View Article


[LeetCode]Number Complement

题目描述:LeetCode 476. Number ComplementGiven a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.Note:The given integer is guaranteed...

View Article

[LeetCode]Magical String

题目描述:LeetCode 481. Magical StringA magical string S consists of only '1' and '2' and obeys the following rules:The string S is magical because concatenating the number of contiguous occurrences of...

View Article

[LeetCode]License Key Formatting

题目描述:LeetCode 482. License Key FormattingNow you are given a string S, which represents a software license key which we would like to format. The string S is composed of alphanumerical characters and...

View Article

[LeetCode]Sliding Window Median

题目描述:LeetCode 480. Sliding Window MedianMedian 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...

View Article


LeetCode Weekly Contest 14解题报告

LeetCode Weekly Contest 14是LeetCode举办的第十七场正式周赛,共4道题目,比赛时长2小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-14/题解列表:LeetCode 476. Number ComplementLeetCode 481. Magical StringLeetCode 482....

View Article

[LeetCode]Max Consecutive Ones

题目描述:LeetCode 485. Max Consecutive OnesGiven a binary array, find the maximum number of consecutive 1s in this array.Example 1:Input: [1,1,0,1,1,1]Output: 3Explanation: The first two digits or the last...

View Article


[LeetCode]Max Consecutive Ones II

题目描述:LeetCode 487. Max Consecutive Ones IIGiven a binary array, find the maximum number of consecutive 1s in this array if you can flip at most one 0.Example 1:Input: [1,0,1,1,0]Output: 4Explanation:...

View Article

[LeetCode]Zuma Game

题目描述:LeetCode 488. Zuma GameThink about Zuma Game. You have a row of balls on the table, colored red(R), yellow(Y), blue(B), green(G), and white(W). You also have several balls in your hand.Each time,...

View Article


LeetCode Weekly Contest 15解题报告

LeetCode Weekly Contest 15是LeetCode举办的第十八场正式周赛,共3道题目,比赛时长1.5小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-15/题解列表:LeetCode 485. Max Consecutive OnesLeetCode 487. Max Consecutive Ones...

View Article

[LeetCode]Find Permutation

题目描述:LeetCode 484. Find PermutationBy now, you are given a secret signature consisting of character 'D' and 'I'. 'D' represents a decreasing relationship between two numbers, 'I' represents an...

View Article

[LeetCode]Target sum

题目描述:LeetCode 494. Target sumYou are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols + and -. For each integer, you should choose one from + and - as its...

View Article
Browsing all 559 articles
Browse latest View live