GoCalf Calf 的自留地 · 昙花一现

全站内容

hard

  • 3219. Minimum Cost for Cutting Cake II

    Coding

    跟 3218. Minimum Cost for Cutting Cake I 一模一样,只不过 m 和 n 的量级从 20 增加到 10⁵,因此只能用 O(n log n) 贪心解法。 https://leetcode.cn/problems/minimum-cost-for-cutting-cake-ii/

    hard
  • 3218. Minimum Cost for Cutting Cake I

    Coding

    #Problem There is an m x n cake that needs to be cut into 1 x 1 pieces. You are given integers m, n, and two arrays: horizontalCut of size m - 1, where horizontalCut[i] represents the cost to cut along the horizontal line i. verticalCut of …

    medium hard
  • 2360. Longest Cycle in a Graph

    Coding

    #Problem You are given a directed graph of n nodes numbered from 0 to n - 1, where each node has at most one outgoing edge. The graph is represented with a given 0-indexed array edges of size n, indicating that there is a directed edge from …

    hard
  • 2608. Shortest Cycle in a Graph

    Coding

    #Problem There is a bi-directional graph with n vertices, where each vertex is labeled from 0 to n - 1. The edges in the graph are represented by a given 2D integer array edges, where edges[i] = [uᵢ, vᵢ] denotes an edge between vertex uᵢ …

    hard
  • 3203. Find Minimum Diameter After Merging Two Trees

    Coding

    #Problem There exist two undirected trees with n and m nodes, numbered from 0 to n - 1 and from 0 to m - 1, respectively. You are given two 2D integer arrays edges1 and edges2 of lengths n - 1 and m - 1, respectively, where edges1[i] = [aᵢ, …

    hard
  • 2127. Maximum Employees to Be Invited to a Meeting

    Coding

    #Problem A company is organizing a meeting and has a list of n employees, waiting to be invited. They have arranged for a large circular table, capable of seating any number of employees. The employees are numbered from 0 to n - 1. Each …

    hard
  • 685. Redundant Connection II

    Coding

    #Problem In this problem, a rooted tree is a directed graph such that, there is exactly one node (the root) for which all other nodes are descendants of this node, plus every node has exactly one parent, except for the root node which has …

    hard
  • 1591. Strange Printer II

    Coding

    #Problem 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 the existing colors in the rectangle. Once …

    hard
  • 2940. Find Building Where Alice and Bob Can Meet

    Coding

    #Problem You are given a 0-indexed array heights of positive integers, where heights[i] represents the height of the iᵗʰ building. If a person is in building i, they can move to any other building j if and only if i < j and heights[i] < …

    hard
  • 664. Strange Printer

    Coding

    #Problem There is a strange printer with the following two special properties: The printer can only print a sequence of the same character each time. At each turn, the printer can print new characters starting from and ending at any place …

    hard