LeetCode Weekly Contest 22解题报告
LeetCode Weekly Contest 22是LeetCode举办的第二十七场正式周赛,共4道题目,比赛时长1.5小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-22/题解列表:LeetCode 532. K-diff Pairs in an ArrayLeetCode 531. Lonely Pixel...
View Article[LeetCode]Single Element in a Sorted Array
题目描述:LeetCode 540. Single Element in a Sorted ArrayGiven a sorted array consisting of only integers where every element appears twice except for one element which appears once. Find this single element...
View Article[LeetCode]Reverse String II
题目描述:LeetCode 541. Reverse String IIGiven a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k...
View Article[LeetCode]Minimum Time Difference
题目描述:LeetCode 539. Minimum Time DifferenceGiven a list of 24-hour clock time points in "Hour:Minutes" format, find the minimum minutes difference between any two time points in the list.Example...
View Article[LeetCode]Construct Binary Tree from String
题目描述:LeetCode 536. Construct Binary Tree from StringYou need to construct a binary tree from a string consisting of parenthesis and integers.The whole input represents a binary tree. It contains an...
View Article[LeetCode]Word Abbreviation
题目描述:LeetCode 527. Word AbbreviationGiven an array of n distinct non-empty strings, you need to generate minimal possible abbreviations for every word following rules below.Begin with the first...
View ArticleLeetCode Weekly Contest 23解题报告
LeetCode Weekly Contest 23是LeetCode举办的第二十八场正式周赛,共4道题目,比赛时长1.5小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-23/题解列表:LeetCode 541. Reverse String IILeetCode 539. Minimum Time...
View Article[LeetCode]Diameter of Binary Tree
题目描述:LeetCode 543. Diameter of Binary TreeGiven a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any...
View Article[LeetCode]Convert BST to Greater Tree
题目描述:LeetCode 538. Convert BST to Greater TreeGiven a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all keys...
View Article[LeetCode]01 Matrix
题目描述:LeetCode 542. 01 MatrixGiven a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell.The distance between two adjacent cells is 1.Example 1: Input: 0 0 0 0 1 0 0 0 0Output:...
View Article[LeetCode]Output Contest Matches
题目描述:LeetCode 544. Output Contest MatchesDuring the NBA playoffs, we always arrange the rather strong team to play with the rather weak team, like make the rank 1 team play with the rank nth team,...
View ArticleLeetCode Weekly Contest 24解题报告
LeetCode Weekly Contest 24是LeetCode举办的第二十九场正式周赛,共4道题目,比赛时长1.5小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-24/题解列表:LeetCode 543. Diameter of Binary TreeLeetCode 538. Convert BST to...
View Article[LeetCode]Perfect Number
题目描述:LeetCode 507. Perfect NumberWe define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except itself.Now, given an integer n, write a function that...
View Article[LeetCode]Complex Number Multiplication
题目描述:LeetCode 537. Complex Number MultiplicationGiven two strings representing two complex numbers.You need to return a string representing their multiplication. Note i2 = -1 according to the...
View Article[LeetCode]Boundary of Binary Tree
题目描述:LeetCode 545. Boundary of Binary TreeGiven a binary tree, return the values of its boundary in anti-clockwise direction starting from root. Boundary includes left boundary, leaves, and right...
View Article[LeetCode]Remove Boxes
题目描述:LeetCode 546. Remove BoxesGiven several boxes with different colors represented by different positive numbers. You may experience several rounds to remove boxes until there is no box left. Each...
View ArticleLeetCode Weekly Contest 25解题报告
LeetCode Weekly Contest 25是LeetCode举办的第三十场正式周赛,共4道题目,比赛时长1.5小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-25/题解列表:LeetCode 507. Perfect NumberLeetCode 537. Complex Number...
View Article[LeetCode]Longest Uncommon Subsequence I
题目描述:LeetCode 521. Longest Uncommon Subsequence IGiven a group of two strings, you need to find the longest uncommon subsequence of this group of two strings. The longest uncommon subsequence is...
View Article[LeetCode]Longest Uncommon Subsequence II
题目描述:LeetCode 522. Longest Uncommon Subsequence IIGiven a list of strings, you need to find the longest uncommon subsequence among them. The longest uncommon subsequence is defined as the longest...
View Article[LeetCode]Friend Circles
题目描述:LeetCode 547. Friend CirclesThere are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For example, if A is a direct friend of B, and...
View Article