原文链接: https://leetcode-cn.com/problems/rank-transform-of-a-matrix 英文原文Given an m x n matrix, return a new matrix answer where answer[row][col] is the rank of matrix[row][col]. The rank is an integer that represents how large an element is compared to…
标签详情
图 分类
原文链接: https://leetcode-cn.com/problems/validate-binary-tree-nodes 英文原文You have n binary tree nodes numbered from 0 to n - 1 where node i has two children leftChild[i] and rightChild[i], return true if and only if all the given nodes form exactly one …
原文链接: https://leetcode-cn.com/problems/critical-connections-in-a-network 英文原文There are n servers numbered from 0 to n - 1 connected by undirected server-to-server connections forming a network where connections[i] = [ai, bi] represents a connection b…
原文链接: https://leetcode-cn.com/problems/sort-items-by-groups-respecting-dependencies 英文原文There 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 belong…
原文链接: https://leetcode-cn.com/problems/count-ways-to-build-rooms-in-an-ant-colony 英文原文You are an ant tasked with adding n new rooms numbered 0 to n-1 to your colony. You are given the expansion plan as a 0-indexed integer array of length n, prevRoom,…
原文链接: https://leetcode-cn.com/problems/path-with-maximum-probability 英文原文You are given an undirected weighted graph of n nodes (0-indexed), represented by an edge list where edges[i] = [a, b] is an undirected edge connecting the nodes a and b with a …
原文链接: https://leetcode-cn.com/problems/number-of-operations-to-make-network-connected 英文原文There 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 be…
原文链接: https://leetcode-cn.com/problems/find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance 英文原文There are n cities numbered from 0 to n-1. Given the array edges where edges[i] = [fromi, toi, weighti] represents a bidirectional …
原文链接: https://leetcode-cn.com/problems/minimum-cost-to-make-at-least-one-valid-path-in-a-grid 英文原文Given a m x n grid. Each cell of the grid has a sign pointing to the next cell you should visit if you are currently in this cell. The sign of grid[i][j…
原文链接: https://leetcode-cn.com/problems/frog-position-after-t-seconds 英文原文Given an undirected tree consisting of n vertices numbered from 1 to n. A frog starts jumping from vertex 1. In one second, the frog jumps from its current vertex to another unv…
原文链接: https://leetcode-cn.com/problems/course-schedule-iv 英文原文There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must t…
原文链接: https://leetcode-cn.com/problems/reorder-routes-to-make-all-paths-lead-to-the-city-zero 英文原文There are n cities numbered from 0 to n - 1 and n - 1 roads such that there is only one way to travel between two different cities (this network form a …
原文链接: https://leetcode-cn.com/problems/parallel-courses-ii 英文原文You are given an integer n, which indicates that there are n courses labeled from 1 to n. You are also given an array relations where relations[i] = [prevCoursei, nextCoursei], representi…
原文链接: https://leetcode-cn.com/problems/find-critical-and-pseudo-critical-edges-in-minimum-spanning-tree 英文原文Given a weighted undirected connected graph with n vertices numbered from 0 to n - 1, and an array edges where edges[i] = [ai, bi, weighti] re…
原文链接: https://leetcode-cn.com/problems/minimum-number-of-vertices-to-reach-all-nodes 英文原文Given a directed acyclic graph, with n vertices numbered from 0 to n-1, and an array edges where edges[i] = [fromi, toi] represents a directed edge from node fro…
原文链接: https://leetcode-cn.com/problems/strange-printer-ii 英文原文There is a strange printer with the following two special requirements: On each turn, the printer will print a solid rectangular pattern of a single color on the grid. This will cover up t…
原文链接: https://leetcode-cn.com/problems/remove-max-number-of-edges-to-keep-graph-fully-traversable 英文原文Alice 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…
原文链接: https://leetcode-cn.com/problems/largest-color-value-in-a-directed-graph 英文原文There is a directed graph of n colored nodes and m edges. The nodes are numbered from 0 to n - 1. You are given a string colors where colors[i] is a lowercase English …
原文链接: https://leetcode-cn.com/problems/minimum-cost-to-reach-destination-in-time 英文原文There is a country of n cities numbered from 0 to n - 1 where all the cities are connected by bi-directional roads. The roads are represented as a 2D integer array e…
原文链接: https://leetcode-cn.com/problems/number-of-ways-to-arrive-at-destination 英文原文You are in a city that consists of n intersections numbered from 0 to n - 1 with bi-directional roads between some intersections. The inputs are generated such that yo…
原文链接: https://leetcode-cn.com/problems/find-if-path-exists-in-graph 英文原文There is a bi-directional graph with n vertices, where each vertex is labeled from 0 to n - 1 (inclusive). The edges in the graph are represented as a 2D integer array edges, whe…
原文链接: https://leetcode-cn.com/problems/the-time-when-the-network-becomes-idle 英文原文There is a network of n servers, labeled from 0 to n - 1. You are given a 2D integer array edges, where edges[i] = [ui, vi] indicates there is a message channel between…
原文链接: https://leetcode-cn.com/problems/second-minimum-time-to-reach-destination 英文原文A city is represented as a bi-directional connected graph with n vertices where each vertex is labeled from 1 to n (inclusive). The edges in the graph are represented…
原文链接: https://leetcode-cn.com/problems/parallel-courses-iii 英文原文You are given an integer n, which indicates that there are n courses labeled from 1 to n. You are also given a 2D integer array relations where relations[j] = [prevCoursej, nextCoursej] …
原文链接: https://leetcode-cn.com/problems/maximum-path-quality-of-a-graph 英文原文There is an undirected graph with n nodes numbered from 0 to n - 1 (inclusive). You are given a 0-indexed integer array values where values[i] is the value of the ith node. Yo…
原文链接: https://leetcode-cn.com/problems/process-restricted-friend-requests 英文原文You are given an integer n indicating the number of people in a network. Each person is labeled from 0 to n - 1. You are also given a 0-indexed 2D integer array restriction…
原文链接: https://leetcode-cn.com/problems/find-all-people-with-secret 英文原文You are given an integer n indicating there are n people numbered from 0 to n - 1. You are also given a 0-indexed 2D integer array meetings where meetings[i] = [xi, yi, timei] ind…
原文链接: https://leetcode-cn.com/problems/broken-board-dominoes 中文题目你有一块棋盘,棋盘上有一些格子已经坏掉了。你还有无穷块大小为1 * 2的多米诺骨牌,你想把这些骨牌不重叠地覆盖在完好的格子上,请找出你最多能在棋盘上放多少块骨牌?这些骨牌可以横着或者竖着放。 输入:n, m代表棋盘的大小;broken是一个b * 2的二维数组,其中每个元素代表棋盘上每一个坏掉的格子的位置。 输出:一个整数,代表最多能在棋盘上放的骨牌数。 示例 1: …
原文链接: https://leetcode-cn.com/problems/route-between-nodes-lcci 英文原文Given a directed graph, design an algorithm to find out whether there is a route between two nodes. Example1: Input: n = 3, graph = [[0, 1], [0, 2], [1, 2], [1, 2]], start = 0, targe…
原文链接: https://leetcode-cn.com/problems/chuan-di-xin-xi 英文原文 中文题目小朋友 A 在和 ta 的小伙伴们玩传信息游戏,游戏规则如下: 有 n 名玩家,所有玩家编号分别为 0 ~ n-1,其中小朋友 A 的编号为 0 每个玩家都有固定的若干个可传信息的其他玩家(也可能没有)。传信息的关系是单向的(比如 A 可以向 B 传信息,但 B 不能向 A 传信息)。 每轮信息必须需要传递给另一个人,且信息可重复经过同一个人 给定总玩家数 n,以及按 …