GoCalf Calf 的自留地 · 昙花一现

全站内容

Calf

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

  • 3159. Find Occurrences of an Element in an Array

    Coding

    #Problem You are given an integer array nums, an integer array queries, and an integer x. For each queries[i], you need to find the index of the queries[i]ᵗʰ occurrence of x in the nums array. If there are fewer than queries[i] occurrences …

    medium
  • 3160. Find the Number of Distinct Colors Among the Balls

    Coding

    #Problem You are given an integer limit and a 2D array queries of size n x 2. There are limit + 1 balls with distinct labels in the range [0, limit]. Initially, all balls are uncolored. For every query in queries that is of the form [x, y], …

    medium
  • 3174. Clear Digits

    Coding

    #Problem You are given a string s. Your task is to remove all digits by doing this operation repeatedly: Delete the first digit and the closest non-digit character to its left. Return the resulting string after removing all digits. …

    easy
  • 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
  • 3206. Alternating Groups I

    Coding

    #Problem There is a circle of red and blue tiles. You are given an array of integers colors. The color of tile i is represented by colors[i]: colors[i] == 0 means that tile i is red. colors[i] == 1 means that tile i is blue. Every 3 …

    easy
  • 3208. Alternating Groups II

    Coding

    #Problem There is a circle of red and blue tiles. You are given an array of integers colors and an integer k. The color of tile i is represented by colors[i]: colors[i] == 0 means that tile i is red. colors[i] == 1 means that tile i is …

    medium
  • 321. Create Maximum Number

    Coding

    #Problem You are given two integer arrays nums1 and nums2 of lengths m and n respectively. nums1 and nums2 represent the digits of two numbers. You are also given an integer k. Create the maximum number of length k <= m + n from digits of …

    hard todo
  • 3213. Construct String with Minimum Cost

    Coding

    #Problem You are given a string target, an array of strings words, and an integer array costs, both arrays of the same length. Imagine an empty string s. You can perform the following operation any number of times (including zero): Choose …

    hard difficult
  • 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
  • 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