GoCalf Calf 的自留地 · 昙花一现

全站内容

Calf

这里收录 Calf 在 GoCalf 上的文章、笔记与其他内容。

  • 2872. Maximum Number of K-Divisible Components

    Coding

    #Problem There is an undirected tree with n nodes labeled from 0 to n - 1. You are given the integer n and a 2D integer array edges of length n - 1, where edges[i] = [aᵢ, bᵢ] indicates that there is an edge between nodes aᵢ and bᵢ in the …

    hard
  • 292. Nim Game

    Coding

    #Problem You are playing the following Nim Game with your friend: Initially, there is a heap of stones on the table. You and your friend will alternate taking turns, and you go first. On each turn, the person whose turn it is will remove 1 …

    easy
  • 2920. Maximum Points After Collecting Coins From All Nodes

    Coding

    #Problem There exists an undirected tree rooted at node 0 with n nodes labeled from 0 to n - 1. You are given a 2D integer array edges of length n - 1, where edges[i] = [aᵢ, bᵢ] indicates that there is an edge between nodes aᵢ and bᵢ in the …

    hard
  • 2923. Find Champion I

    Coding

    #Problem There are n teams numbered from 0 to n - 1 in a tournament. Given a 0-indexed 2D boolean matrix grid of size n * n. For all i, j that 0 <= i, j <= n - 1 and i != j team i is stronger than team j if grid[i][j] == 1, otherwise, team …

    easy
  • 2924. Find Champion II

    Coding

    #Problem There are n teams numbered from 0 to n - 1 in a tournament; each team is also a node in a DAG. You are given the integer n and a 0-indexed 2D integer array edges of length m representing the DAG, where edges[i] = [uᵢ, vᵢ] indicates …

    medium
  • 2931. Maximum Spending After Buying Items

    Coding

    #Problem You are given a 0-indexed m * n integer matrix values, representing the values of m * n different items in m different shops. Each shop has n items where the jᵗʰ item in the iᵗʰ shop has a value of values[i][j]. Additionally, the …

    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
  • 2944. Minimum Number of Coins for Fruits

    Coding

    #Problem You are given an 0-indexed integer array prices where prices[i] denotes the number of coins needed to purchase the (i + 1)ᵗʰ fruit. The fruit market has the following reward for each fruit: If you purchase the (i + 1)ᵗʰ fruit at …

    medium
  • 2948. Make Lexicographically Smallest Array by Swapping Elements

    Coding

    #Problem You are given a 0-indexed array of positive integers nums and a positive integer limit. In one operation, you can choose any two indices i and j and swap nums[i] and nums[j] if |nums[i] - nums[j]| <= limit. Return the …

    medium
  • 295. Find Median from Data Stream

    Coding

    #Problem The median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value, and the median is the mean of the two middle values. For example, for arr = [2,3,4], the median is 3. For …

    hard