全站内容
Calf
这里收录 Calf 在 GoCalf 上的文章、笔记与其他内容。
1760. Minimum Limit of Balls in a Bag
#Problem You are given an integer array nums where the iᵗʰ bag contains nums[i] balls. You are also given an integer maxOperations. You can perform the following operation at most maxOperations times: Take any bag of balls and divide it …
1765. Map of Highest Peak
#Problem You are given an integer matrix isWater of size m x n that represents a map of land and water cells. If isWater[i][j] == 0, cell (i, j) is a land cell. If isWater[i][j] == 1, cell (i, j) is a water cell. You must assign each cell a …
1769. Minimum Number of Operations to Move All Balls to Each Box
#Problem You have n boxes. You are given a binary string boxes of length n, where boxes[i] is '0' if the iᵗʰ box is empty, and '1' if it contains one ball. In one operation, you can move one ball from a box to an adjacent box. Box i is …
1790. Check if One String Swap Can Make Strings Equal
#Problem You are given two strings s1 and s2 of equal length. A string swap is an operation where you choose two indices in a string (not necessarily different) and swap the characters at these indices. Return true if it is possible to make …
1792. Maximum Average Pass Ratio
#Problem There is a school that has classes of students and each class will be having a final exam. You are given a 2D integer array classes, where classes[i] = [passᵢ, totalᵢ]. You know beforehand that in the iᵗʰ class, there are totalᵢ …
1800. Maximum Ascending Subarray Sum
#Problem Given an array of positive integers nums, return the maximum possible sum of an ascending subarray in nums. A subarray is defined as a contiguous sequence of numbers in an array. A subarray [numsl, numsl+1, ..., numsr-1, numsr] is …
1812. Determine Color of a Chessboard Square
#Problem You are given coordinates, a string that represents the coordinates of a square of the chessboard. Below is a chessboard for your reference. problemReturn true if the square is white, and false if the square is black. The …
1847. Closest Room
#Problem There is a hotel with n rooms. The rooms are represented by a 2D integer array rooms where rooms[i] = [roomIdᵢ, sizeᵢ] denotes that there is a room with room number roomIdᵢ and size equal to sizeᵢ. Each roomIdᵢ is guaranteed to be …
188. Best Time to Buy and Sell Stock IV
#Problem You are given an integer array prices where prices[i] is the price of a given stock on the iᵗʰ day, and an integer k. Find the maximum profit you can achieve. You may complete at most k transactions: i.e. you may buy at most k …
19. Remove Nth Node From End of List
#Problem Given the head of a linked list, remove the nᵗʰ node from the end of the list and return its head. https://leetcode.com/problems/remove-nth-node-from-end-of-list/ Example 1: case1Input: head = [1,2,3,4,5], n = 2 Output: [1,2,3,5] …