[LeetCode]Minimum Moves to Equal Array Elements
题目描述:LeetCode 453. Minimum Moves to Equal Array ElementsGiven a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is...
View Article[LeetCode]Number of Boomerangs
题目描述:LeetCode 447. Number of BoomerangsGiven n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between i and j equals the...
View Article[LeetCode]Minimum Number of Arrows to Burst Balloons
题目描述:LeetCode 452. Minimum Number of Arrows to Burst BalloonsThere are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates...
View Article[LeetCode]Arithmetic Slices II - Subsequence
题目描述:LeetCode 446. Arithmetic Slices II - SubsequenceA sequence of numbers is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is...
View Article[LeetCode]Smarking Algorithm Contest 3解题报告
Smarking Algorithm Contest 3是LeetCode举办的第十一场正式周赛,共4道题目,比赛时长2.5小时。比赛链接:https://leetcode.com/contest/detail/12题解列表:LeetCode 453. Minimum Moves to Equal Array ElementsLeetCode 447. Number of...
View Article[LeetCode]Poor Pigs
题目描述:LeetCode 458. Poor PigsThere are 1000 buckets, one and only one of them contains poison, the rest are filled with water. They all look the same. If a pig drinks that poison it will die within 15...
View Article[LeetCode]Circular Array Loop
题目描述:LeetCode 457. Circular Array LoopYou are given an array of positive and negative integers. If a number n at an index is positive, then move forward n steps. Conversely, if it's negative (-n), move...
View Article[LeetCode]Delete Node in a BST
题目描述:LeetCode 450. Delete Node in a BSTGiven a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the...
View Article[LeetCode]Assign Cookies
题目描述:LeetCode 455. Assign CookiesAssume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi,...
View Article[LeetCode]Repeated Substring Pattern
题目描述:LeetCode 459. Repeated Substring PatternGiven a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume...
View Article[LeetCode]4Sum II
题目描述:LeetCode 454. 4Sum IIGiven four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero.To make problem a bit easier, all A,...
View Article[LeetCode]132 Pattern
题目描述:LeetCode 456. 132 PatternGiven a sequence of n integers a1, a2, ..., an, a 132 pattern is a subsequence ai, aj, ak such that i< j< k and ai< ak< aj. Design an algorithm that takes a...
View Article[LeetCode]Smarking Algorithm Contest 4解题报告
Smarking Algorithm Contest 4是LeetCode举办的第十二场正式周赛,共4道题目,比赛时长2.5小时。比赛链接:https://leetcode.com/contest/detail/13题解列表:LeetCode 455. Assign CookiesLeetCode 459. Repeated Substring PatternLeetCode 454. 4Sum...
View Article[LeetCode]Island Perimeter
题目描述:LeetCode 463. Island PerimeterYou are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not...
View Article[LeetCode]Can I Win
题目描述:LeetCode 464. Can I WinIn the "100 game," two players take turns adding, to a running total, any integer from 1..10. The player who first causes the running total to reach or exceed 100 wins.What...
View Article[LeetCode]Minimum Moves to Equal Array Elements II
题目描述:LeetCode 462. Minimum Moves to Equal Array Elements IIGiven a non-empty integer array, find the minimum number of moves required to make all array elements equal, where a move is incrementing a...
View ArticleLeetCode Weekly Contest 10解题报告
LeetCode Weekly Contest 10是LeetCode举办的第十三场正式周赛,共4道题目,比赛时长2.5小时。比赛链接:https://leetcode.com/contest/leetcode-weekly-contest-10/题解列表:LeetCode 463. Island PerimeterLeetCode 464. Can I WinLeetCode 462....
View Article[LeetCode]Optimal Account Balancing
题目描述:LeetCode 465. Optimal Account BalancingA group of friends went on holiday and sometimes lent each other money. For example, Alice paid for Bill's lunch for $10. Then later Chris gave Alice $5 for...
View Article[LeetCode]LFU Cache
题目描述:LeetCode 460. LFU CacheDesign and implement a data structure for Least Frequently Used (LFU) cache. It should support the following operations: get and set.get(key) - Get the value (will always be...
View Article[LeetCode]Validate IP Address
题目描述:LeetCode 468. Validate IP AddressIn this problem, your job to write a function to check whether a input string is a valid IPv4 address or IPv6 address or neither.IPv4 addresses are canonically...
View Article