全站内容
Calf
这里收录 Calf 在 GoCalf 上的文章、笔记与其他内容。
322. Coin Change
#Problem You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. Return the fewest number of coins that you need to make up that amount. If that amount …
3222. Find the Winning Player in Coin Game
#Problem You are given two positive integers x and y, denoting the number of coins with values 75 and 10 respectively. Alice and Bob are playing a game. Each turn, starting with Alice, the player must pick up coins with a total value 115. …
3223. Minimum Length of String After Operations
#Problem You are given a string s. You can perform the following process on s any number of times: Choose an index i in the string such that there is at least one character to the left of index i that is equal to s[i], and at least one …
3226. Number of Bit Changes to Make Two Integers Equal
#Problem You are given two positive integers n and k. You can choose any bit in the binary representation of n that is equal to 1 and change it to 0. Return the number of changes needed to make n equal to k. If it is impossible, return -1. …
3232. Find if Digit Game Can Be Won
#Problem You are given an array of positive integers nums. Alice and Bob are playing a game. In the game, Alice can choose either all single-digit numbers or all double-digit numbers from nums, and the rest of the numbers are given to Bob. …
3233. Find the Count of Numbers Which Are Not Special
#Problem You are given 2 positive integers l and r. For any number x, all positive divisors of x except x are called the proper divisors of x. A number is called special if it has exactly 2 proper divisors. For example: The number 4 is …
3235. Check if the Rectangle Corner Is Reachable
#Problem You are given two positive integers xCorner and yCorner, and a 2D array circles, where circles[i] = [xᵢ, yᵢ, rᵢ] denotes a circle with center at (xᵢ, yᵢ) and radius rᵢ. There is a rectangle in the coordinate plane with its bottom …
3238. Find the Number of Winning Players
#Problem You are given an integer n representing the number of players in a game and a 2D array pick where pick[i] = [xᵢ, yᵢ] represents that the player xᵢ picked a ball of color yᵢ. Player i wins the game if they pick strictly more than i …
3239. Minimum Number of Flips to Make Binary Grid Palindromic I
#Problem You are given an m x n binary matrix grid. A row or column is considered palindromic if its values read the same forward and backward. You can flip any number of cells in grid from 0 to 1, or from 1 to 0. Return the minimum number …
3240. Minimum Number of Flips to Make Binary Grid Palindromic II
#Problem You are given an m x n binary matrix grid. A row or column is considered palindromic if its values read the same forward and backward. You can flip any number of cells in grid from 0 to 1, or from 1 to 0. Return the minimum number …