GoCalf Calf 的自留地 · 昙花一现

全站内容

medium

  • 1552. Magnetic Force Between Two Balls

    Coding

    #Problem In the universe Earth C-137, Rick discovered a special form of magnetic force between two balls if they are put in his new invented basket. Rick has n empty baskets, the iᵗʰ basket is at position[i], Morty has m balls and needs to …

    medium
  • 2342. Max Sum of a Pair With Equal Sum of Digits

    Coding

    #Problem You are given a 0-indexed array nums consisting of positive integers. You can choose two indices i and j, such that i != j, and the sum of digits of the number nums[i] is equal to that of nums[j]. Return the maximum value of …

    medium
  • 1910. Remove All Occurrences of a Substring

    Coding

    #Problem Given two strings s and part, perform the following operation on s until all occurrences of the substring part are removed: Find the leftmost occurrence of the substring part and remove it from s. Return s after removing all …

    medium
  • 2364. Count Number of Bad Pairs

    Coding

    #Problem You are given a 0-indexed integer array nums. A pair of indices (i, j) is a bad pair if i < j and j - i != nums[j] - nums[i]. Return the total number of bad pairs in nums. https://leetcode.com/problems/count-number-of-bad-pairs/ …

    medium
  • 80. Remove Duplicates from Sorted Array II

    Coding

    #Problem Given an integer array nums sorted in non-decreasing order, remove some duplicates in-place such that each unique element appears at most twice. The relative order of the elements should be kept the same. Since it is impossible to …

    medium
  • 2349. Design a Number Container System

    Coding

    #Problem Design a number container system that can do the following: Insert or Replace a number at the given index in the system. Return the smallest index for the given number in the system. Implement the NumberContainers class: …

    medium
  • 63. Unique Paths II

    Coding

    #Problem You are given an m x n integer array grid. There is a robot initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner (i.e., grid[m - 1][n - 1]). The robot can only move either …

    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
  • 1726. Tuple with Same Product

    Coding

    #Problem Given an array nums of distinct positive integers, return the number of tuples (a, b, c, d) such that a * b = c * d where a, b, c, and d are elements of nums, and a != b != c != d. …

    medium
  • 81. Search in Rotated Sorted Array II

    Coding

    #Problem There is an integer array nums sorted in non-decreasing order (not necessarily with distinct values). Before being passed to your function, nums is rotated at an unknown pivot index k (0 <= k < nums.length) such that the resulting …

    medium