![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode每日一题202101
文章平均质量分 69
leetcode每日一题20211
Bryan要加油
这个作者很懒,什么都没留下…
展开
-
839. Similar String Groups(Leetcode每日一题-2021.01.31)
ProblemTwo strings X and Y are similar if we can swap two letters (in different positions) of X, so that it equals Y. Also two strings X and Y are similar if they are equal.For example, “tars” and “rats” are similar (swapping at positions 0 and 2), and “原创 2021-01-31 19:39:08 · 144 阅读 · 0 评论 -
778. Swim in Rising Water(Leetcode每日一题-2021.01.30)--抄答案
ProblemOn an N x N grid, each square grid[i][j] represents the elevation at that point (i,j).Now rain starts to fall. At time t, the depth of the water everywhere is t. You can swim from a square to another 4-directionally adjacent square if and only if原创 2021-01-30 20:04:13 · 203 阅读 · 0 评论 -
1631. Path With Minimum Effort(Leetcode每日一题-2021.01.29)--抄答案
ProblemYou are a hiker preparing for an upcoming hike. You are given heights, a 2D array of size rows x columns, where heights[row][col] represents the height of cell (row, col). You are situated in the top-left cell, (0, 0), and you hope to travel to the原创 2021-01-29 19:44:48 · 208 阅读 · 0 评论 -
724. Find Pivot Index(Leetcode每日一题-2021.01.28)
ProblemGiven an array of integers nums, write a method that returns the “pivot” index of this array.We define the pivot index as the index where the sum of all the numbers to the left of the index is equal to the sum of all the numbers to the right of th原创 2021-01-28 20:57:37 · 166 阅读 · 0 评论 -
1579. Remove Max Number of Edges to Keep Graph Fully Traversable(Leetcode每日一题-2021.01.27)--抄答案
ProblemAlice and Bob have an undirected graph of n nodes and 3 types of edges:Type 1: Can be traversed by Alice only.Type 2: Can be traversed by Bob only.Type 3: Can by traversed by both Alice and Bob.Given an array edges where edges[i] = [typei, ui原创 2021-01-27 21:57:11 · 250 阅读 · 0 评论 -
1128. Number of Equivalent Domino Pairs(Leetcode每日一题-2021.01.26)
ProblemGiven a list of dominoes, dominoes[i] = [a, b] is equivalent to dominoes[j] = [c, d] if and only if either (ac and bd), or (ad and bc) - that is, one domino can be rotated to be equal to another domino.Return the number of pairs (i, j) for which 0原创 2021-01-26 21:49:55 · 149 阅读 · 0 评论 -
959. Regions Cut By Slashes(Leetcode每日一题-2021.01.25)--抄答案
ProblemIn a N x N grid composed of 1 x 1 squares, each 1 x 1 square consists of a /, , or blank space. These characters divide the square into contiguous regions.(Note that backslash characters are escaped, so a \ is represented as “\”.)Return the numb原创 2021-01-25 22:49:03 · 132 阅读 · 0 评论 -
1319. Number of Operations to Make Network Connected(Leetcode每日一题-2021.01.23)--抄答案
ProblemThere are n computers numbered from 0 to n-1 connected by ethernet cables connections forming a network where connections[i] = [a, b] represents a connection between computers a and b. Any computer can reach any other computer directly or indirectl原创 2021-01-23 21:48:13 · 147 阅读 · 1 评论 -
989. Add to Array-Form of Integer(Leetcode每日一题-2021.01.22)
ProblemFor a non-negative integer X, the array-form of X is an array of its digits in left to right order. For example, if X = 1231, then the array form is [1,2,3,1].Given the array-form A of a non-negative integer X, return the array-form of the intege原创 2021-01-23 21:45:38 · 183 阅读 · 0 评论 -
1489. Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree(Leetcode每日一题-2021.01.21)--抄答案
ProblemGiven a weighted undirected connected graph with n vertices numbered from 0 to n - 1, and an array edges where edges[i] = [ai, bi, weighti] represents a bidirectional and weighted edge between nodes ai and bi. A minimum spanning tree (MST) is a sub原创 2021-01-21 20:19:05 · 329 阅读 · 0 评论 -
628. Maximum Product of Three Numbers(Leetcode每日一题-2021.01.20)
ProblemGiven an integer array nums, find three numbers whose product is maximum and return the maximum product.Constraints:3 <= nums.length <= 10^4-1000 <= nums[i] <= 1000Example1Input: nums = [1,2,3]Output: 6Example2Input: nums =原创 2021-01-20 20:18:58 · 113 阅读 · 0 评论 -
1584. Min Cost to Connect All Points(Leetcode每日一题-2021.01.19)
ProblemYou are given an array points representing integer coordinates of some points on a 2D-plane, where points[i] = [xi, yi].The cost of connecting two points [xi, yi] and [xj, yj] is the manhattan distance between them: |xi - xj| + |yi - yj|, where |v原创 2021-01-19 18:08:15 · 207 阅读 · 0 评论 -
721. Accounts Merge(Leetcode每日一题-2021.01.18)--抄答案
ProblemGiven a list accounts, each element accounts[i] is a list of strings, where the first element accounts[i][0] is a name, and the rest of the elements are emails representing emails of the account.Now, we would like to merge these accounts. Two acco原创 2021-01-18 20:42:42 · 224 阅读 · 0 评论 -
1232. Check If It Is a Straight Line(Leetcode每日一题-2021.01.17)
ProblemYou are given an array coordinates, coordinates[i] = [x, y], where [x, y] represents the coordinate of a point. Check if these points make a straight line in the XY plane.Constraints:2 <= coordinates.length <= 1000coordinates[i].length ==原创 2021-01-17 22:00:43 · 188 阅读 · 0 评论 -
803. Bricks Falling When Hit(Leetcode每日一题-2021.01.16)--抄答案
ProblemYou are given an m x n binary grid, where each 1 represents a brick and 0 represents an empty space. A brick is stable if:It is directly connected to the top of the grid, orAt least one other brick in its four adjacent cells is stable.You are原创 2021-01-16 21:45:09 · 228 阅读 · 0 评论 -
947. Most Stones Removed with Same Row or Column(Leetcode每日一题-2021.01.15)
ProblemOn a 2D plane, we place n stones at some integer coordinate points. Each coordinate point may have at most one stone.A stone can be removed if it shares either the same row or the same column as another stone that has not been removed.Given an ar原创 2021-01-15 21:12:29 · 176 阅读 · 0 评论 -
1018. Binary Prefix Divisible By 5(Leetcode每日一题-2021.01.14)
ProblemGiven an array A of 0s and 1s, consider N_i: the i-th subarray from A[0] to A[i] interpreted as a binary number (from most-significant-bit to least-significant-bit.)Return a list of booleans answer, where answer[i] is true if and only if N_i is di原创 2021-01-14 20:59:15 · 270 阅读 · 0 评论 -
684. Redundant Connection(Leetcode每日一题-2021.01.13)--抄答案
ProblemIn this problem, a tree is an undirected graph that is connected and has no cycles.The given input is a graph that started as a tree with N nodes (with distinct values 1, 2, …, N), with one additional edge added. The added edge has two different v原创 2021-01-13 20:59:40 · 157 阅读 · 0 评论 -
1203. Sort Items by Groups Respecting Dependencies(Leetcode每日一题-2021.01.12)--抄答案
ProblemThere are n items each belonging to zero or one of m groups where group[i] is the group that the i-th item belongs to and it’s equal to -1 if the i-th item belongs to no group. The items and the groups are zero indexed. A group can have no item bel原创 2021-01-12 21:05:47 · 190 阅读 · 0 评论 -
1202. Smallest String With Swaps(Leetcode每日一题-2021.01.11)
ProblemYou are given a string s, and an array of pairs of indices in the string pairs where pairs[i] = [a, b] indicates 2 indices(0-indexed) of the string.You can swap the characters at any pair of indices in the given pairs any number of times.Return t原创 2021-01-11 21:54:25 · 174 阅读 · 0 评论 -
228. Summary Ranges(Leetcode每日一题-2021.01.10)
ProblemYou are given a sorted unique integer array nums.Return the smallest sorted list of ranges that cover all the numbers in the array exactly. That is, each element of nums is covered by exactly one of the ranges, and there is no integer x such that原创 2021-01-10 21:09:14 · 134 阅读 · 0 评论 -
123. Best Time to Buy and Sell Stock III(Leetcode每日一题-2021.01.09)
ProblemSay you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note: You may not engage in multiple transactions at the same time (i原创 2021-01-09 09:08:58 · 183 阅读 · 0 评论 -
189. Rotate Array(Leetcode每日一题-2021.01.08)
ProblemGiven an array, rotate the array to the right by k steps, where k is non-negative.Constraints:1 <= nums.length <= 2 * 10^4-2^31 <= nums[i] <= 2^31 - 10 <= k <= 10^5Example1Input: nums = [1,2,3,4,5,6,7], k = 3Output: [5,6原创 2021-01-08 18:28:47 · 70 阅读 · 0 评论 -
547. Number of Provinces(Leetcode每日一题-2021.01.07)
ProblemThere are n cities. Some of them are connected, while some are not. If city a is connected directly with city b, and city b is connected directly with city c, then city a is connected indirectly with city c.A province is a group of directly or ind原创 2021-01-07 19:47:58 · 551 阅读 · 0 评论 -
399. Evaluate Division(Leetcode每日一题-2021.01.06)
ProblemYou are given an array of variable pairs equations and an array of real numbers values, where equations[i] = [Ai, Bi] and values[i] represent the equation Ai / Bi = values[i]. Each Ai or Bi is a string that represents a single variable.You are als原创 2021-01-06 19:11:32 · 219 阅读 · 0 评论 -
830. Positions of Large Groups(Leetcode每日一题-2021.01.05)
ProblemIn a string s of lowercase letters, these letters form consecutive groups of the same character.For example, a string like s = “abbxxxxzyy” has the groups “a”, “bb”, “xxxx”, “z”, and “yy”.A group is identified by an interval [start, end], where s原创 2021-01-05 21:26:31 · 150 阅读 · 0 评论 -
509. Fibonacci Number(Leetcode每日一题-2021.01.04)
The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That is,F(0) = 0, F(1) = 1F(n) = F(n - 1) + F(n - 2), for n > 1.Given n,原创 2021-01-04 20:49:49 · 188 阅读 · 0 评论 -
86. Partition List(Leetcode每日一题-2021.01.03)
ProblemGiven a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nodes in each of the two partitions.ExampleInput: head = 1->4原创 2021-01-04 20:47:11 · 125 阅读 · 0 评论 -
239. Sliding Window Maximum(Leetcode每日一题-2021.01.02)--抄答案
ProblemYou are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position.原创 2021-01-02 17:29:19 · 172 阅读 · 0 评论 -
605. Can Place Flowers(Leetcode每日一题-2021.01.01)--抄答案
ProblemYou have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in adjacent plots.Given an integer array flowerbed containing 0’s and 1’s, where 0 means empty and 1 means not empty, and an int原创 2021-01-01 09:17:56 · 163 阅读 · 0 评论