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

LeetCode Weekly Contest 41解题报告

LeetCode Weekly Contest 41是LeetCode举办的第四十六场正式周赛,共4道题目,比赛时长1.5小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-41/题解列表:LeetCode 643. Maximum Average Subarray ILeetCode 636. Exclusive Time of...

View Article


[LeetCode]Set Mismatch

题目描述:LeetCode 645. Set MismatchThe set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another number in the set,...

View Article


[LeetCode]Maximum Length of Pair Chain

题目描述:LeetCode 646. Maximum Length of Pair ChainYou are given n pairs of numbers. In every pair, the first number is always smaller than the second number.Now, we define a pair (c, d) can follow another...

View Article

[LeetCode]Replace Words

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

View Article

[LeetCode]Palindromic Substrings

题目描述:LeetCode 647. Palindromic SubstringsGiven a string, your task is to count how many palindromic substrings in this string.The substrings with different start indexes or end indexes are counted as...

View Article


LeetCode Weekly Contest 42解题报告

LeetCode Weekly Contest 42是LeetCode举办的第四十七场正式周赛,共4道题目,比赛时长1.5小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-42/题解列表:LeetCode 645. Set MismatchLeetCode 646. Maximum Length of Pair...

View Article

[LeetCode]Find Duplicate Subtrees

题目描述:LeetCode 652. Find Duplicate SubtreesGiven a binary tree, return all duplicate subtrees. For each kind of duplicate subtrees, you only need to return the root node of any one of them.Two trees are...

View Article

[LeetCode]2 Keys Keyboard

题目描述:LeetCode 650. 2 Keys KeyboardInitially on a notepad only one character 'A' is present. You can perform two operations on this notepad for each step:Copy All: You can copy all the characters...

View Article


[LeetCode]Dota2 Senate

题目描述:LeetCode 649. Dota2 SenateIn the world of Dota2, there are two parties: the Radiant and the Dire.The Dota2 senate consists of senators coming from two parties. Now the senate wants to make a...

View Article


[LeetCode]4 Keys Keyboard

题目描述:LeetCode 651. 4 Keys KeyboardImagine you have a special keyboard with the following keys:Key 1: (A): Prints one 'A' on screen.Key 2: (Ctrl-A): Select the whole screen.Key 3: (Ctrl-C): Copy...

View Article

LeetCode Weekly Contest 43解题报告

LeetCode Weekly Contest 43是LeetCode举办的第四十八场正式周赛,共4道题目,比赛时长1.5小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-43/题解列表:LeetCode 652. Find Duplicate SubtreesLeetCode 650. 2 Keys...

View Article

[LeetCode]Two Sum IV - Input is a BST

题目描述:LeetCode 653. Two Sum IV - Input is a BSTGiven a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target.Example...

View Article

[LeetCode]Maximum Binary Tree

题目描述:LeetCode 654. Maximum Binary TreeGiven an integer array with no duplicates. A maximum tree building on this array is defined as follow:The root is the maximum number in the array.The left subtree...

View Article


[LeetCode]Print Binary Tree

题目描述:LeetCode 655. Print Binary TreePrint a binary tree in an m*n 2D string array following these rules:The row number m should be equal to the height of the given binary tree.The column number n...

View Article

[LeetCode]Coin Path

题目描述:LeetCode 656. Coin PathGiven an array A (index starts at 1) consisting of N integers: A1, A2, ..., AN and an integer B. The integer B denotes that from any place (suppose the index is i) in the...

View Article


LeetCode Weekly Contest 44解题报告

LeetCode Weekly Contest 44是LeetCode举办的第四十九场正式周赛,共4道题目,比赛时长1.5小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-44/题解列表:LeetCode 653. Two Sum IV - Input is a BSTLeetCode 654. Maximum Binary...

View Article

[LeetCode]Judge Route Circle

题目描述:LeetCode 657. Judge Route CircleInitially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the original...

View Article


[LeetCode]Find K Closest Elements

题目描述:LeetCode 658. Find K Closest ElementsGiven a sorted array, two integers k and x, find the k closest elements to x in the array. The result should also be sorted in ascending order. If there is a...

View Article

[LeetCode]Split Array into Consecutive Subsequences

题目描述:LeetCode 659. Split Array into Consecutive SubsequencesYou are given an integer array sorted in ascending order (may contain duplicates), you need to split them into several subsequences, where...

View Article

[LeetCode]Remove 9

题目描述:LeetCode 660. Remove 9Start from integer 1, remove any integer that contains 9 such as 9, 19, 29...So now, you will have a new integer sequence: 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, ...Given a positive...

View Article
Browsing all 559 articles
Browse latest View live