全站内容
Calf
这里收录 Calf 在 GoCalf 上的文章、笔记与其他内容。
2209. Minimum White Tiles After Covering With Carpets
#Problem You are given a 0-indexed binary string floor, which represents the colors of tiles on a floor: floor[i] = '0' denotes that the iᵗʰ tile of the floor is colored black. On the other hand, floor[i] = '1' denotes that the iᵗʰ tile of …
221. Maximal Square
#Problem Given an m x n binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area. https://leetcode.com/problems/maximal-square/ Example 1: case1Input: matrix = …
2218. Maximum Value of K Coins From Piles
#Problem There are n piles of coins on a table. Each pile consists of a positive number of coins of assorted denominations. In one move, you can choose any coin on top of any pile, remove it, and add it to your wallet. Given a list piles, …
2239. Find Closest Number to Zero
#Problem Given an integer array nums of size n, return the number with the value closest to 0 in nums. If there are multiple answers, return the number with the largest value. https://leetcode.cn/problems/find-closest-number-to-zero/ …
224. Basic Calculator
#Problem Given a string s representing a valid expression, implement a basic calculator to evaluate it, and return the result of the evaluation. Note: You are not allowed to use any built-in function which evaluates strings as mathematical …
2241. Design an ATM Machine
#Problem There is an ATM machine that stores banknotes of 5 denominations: 20, 50, 100, 200, and 500 dollars. Initially the ATM is empty. The user can use the machine to deposit or withdraw any amount of money. When withdrawing, the machine …
226. Invert Binary Tree
#Problem Given the root of a binary tree, invert the tree, and return its root. https://leetcode.com/problems/invert-binary-tree/ Example 1: case1Input: root = [4,2,7,1,3,6,9] Output: [4,7,2,9,6,3,1] Example 2: case2Input: root = …
2264. Largest 3-Same-Digit Number in String
#Problem You are given a string num representing a large integer. An integer is good if it meets the following conditions: It is a substring of num with length 3. It consists of only one unique digit. Return the maximum good integer as a …
2266. Count Number of Texts
#Problem Alice is texting Bob using her phone. The mapping of digits to letters is shown in the figure below. telephoneIn order to add a letter, Alice has to press the key of the corresponding digit i times, where i is the position of the …
227. Basic Calculator II
#Problem Given a string s which represents an expression, evaluate this expression and return its value. The integer division should truncate toward zero. You may assume that the given expression is always valid. All intermediate results …