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

LeetCode Weekly Contest 33解题报告

LeetCode Weekly Contest 33是LeetCode举办的第三十八场正式周赛,共4道题目,比赛时长1.5小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-33/题解列表:LeetCode 594. Longest Harmonious SubsequenceLeetCode 593. Valid...

View Article


[LeetCode]Range Addition II

题目描述:LeetCode 598. Range Addition IIGiven an m * n matrix M initialized with all 0's and several update operations.Operations are represented by a 2D array, and each operation is represented by an...

View Article


[LeetCode]Minimum Index Sum of Two Lists

题目描述:LeetCode 599. Minimum Index Sum of Two ListsSuppose 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...

View Article

[LeetCode]Non-negative Integers without Consecutive Ones

题目描述:LeetCode 600. Non-negative Integers without Consecutive OnesGiven a positive integer n, find the number of non-negative integers less than or equal to n, whose binary representations do NOT...

View Article

[LeetCode]Array Nesting

题目描述:LeetCode 565. Array NestingA zero-indexed array A consisting of N different integers is given. The array contains all integers in the range [0, N - 1].Sets S[K] for 0 <= K < N are defined as...

View Article


LeetCode Weekly Contest 34解题报告

LeetCode Weekly Contest 34是LeetCode举办的第三十九场正式周赛,共4道题目,比赛时长1.5小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-34/题解列表:LeetCode 598. Range Addition IILeetCode 599. Minimum Index Sum of Two...

View Article

[LeetCode]Can Place Flowers

题目描述:LeetCode 605. Can Place FlowersSuppose 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...

View Article

[LeetCode]Construct String from Binary Tree

题目描述:LeetCode 606. Construct String from Binary TreeYou need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way.The null node needs to be...

View Article


[LeetCode]Find Duplicate File in System

题目描述:LeetCode 609. Find Duplicate File in SystemGiven a list of directory info including directory path, and all the files with contents in this directory, you need to find out all the groups of...

View Article


[LeetCode]Tag Validator

题目描述:LeetCode 591. Tag ValidatorGiven a string representing a code snippet, you need to implement a tag validator to parse the code and return whether it is valid. A code snippet is valid if all the...

View Article

LeetCode Weekly Contest 35解题报告

LeetCode Weekly Contest 35是LeetCode举办的第四十场正式周赛,共4道题目,比赛时长1.5小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-35/题解列表:LeetCode 605. Can Place FlowersLeetCode 606. Construct String from...

View Article

[LeetCode]Merge Two Binary Trees

题目描述:LeetCode 617. Merge Two Binary TreesGiven two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.You...

View Article

[LeetCode]Design Compressed String Iterator

题目描述:LeetCode 604. Design Compressed String IteratorDesign and implement a data structure for a compressed string iterator. It should support the following operations: next and hasNext.The given...

View Article


[LeetCode]Valid Triangle Number

题目描述:LeetCode 611. Valid Triangle NumberGiven an array consists of non-negative integers, your task is to count the number of triplets chosen from the array that can make triangles if we take them as...

View Article

[LeetCode]Add Bold Tag in String

题目描述:LeetCode 616. Add Bold Tag in StringGiven a string s and a list of strings dict, you need to add a closed pair of bold tag <b> and </b> to wrap the substrings in s that exist in dict....

View Article


LeetCode Weekly Contest 36解题报告

LeetCode Weekly Contest 36是LeetCode举办的第四十一场正式周赛,共4道题目,比赛时长1.5小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-36/题解列表:LeetCode 617. Merge Two Binary TreesLeetCode 604. Design Compressed...

View Article

[LeetCode]Maximum Distance in Arrays

题目描述:LeetCode 624. Maximum Distance in ArraysGiven m arrays, and each array is sorted in ascending order. Now you can pick up two integers from two different arrays (each array picks one) and calculate...

View Article


[LeetCode]Add One Row to Tree

题目描述:LeetCode 623. Add One Row to TreeGiven the root of a binary tree, then value v and depth d, you need to add a row of nodes with value v at the given depth d. The root node is at depth 1.The adding...

View Article

[LeetCode]Minimum Factorization

题目描述:LeetCode 625. Minimum FactorizationGiven a positive integer a, find the smallest positive integer b whose multiplication of each digit equals to a.If there is no answer or the answer is not fit in...

View Article

[LeetCode]Task Scheduler

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

View Article
Browsing all 559 articles
Browse latest View live