全站内容
Calf
这里收录 Calf 在 GoCalf 上的文章、笔记与其他内容。
598. Range Addition II
#Problem You are given an m x n matrix M initialized with all 0’s and an array of operations ops, where ops[i] = [aᵢ, bᵢ] means M[x][y] should be incremented by one for all 0 <= x < aᵢ and 0 <= y < bᵢ. Count and return the number of maximum …
62. Unique Paths
#Problem There is a robot on an m x n grid. The robot is 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 down or …
624. Maximum Distance in Arrays
#Problem You are given m arrays, where each array is sorted in ascending order. You can pick up two integers from two different arrays (each array picks one) and calculate the distance. We define the distance between two integers a and b to …
628. Maximum Product of Three Numbers
#Problem Given an integer array nums, find three numbers whose product is maximum and return the maximum product. https://leetcode.com/problems/maximum-product-of-three-numbers/ Example 1: Input: nums = [1,2,3] Output: 6 Example 2: Input: …
63. Unique Paths II
#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 …
632. Smallest Range Covering Elements from K Lists
#Problem You have k lists of sorted integers in non-decreasing order. Find the smallest range that includes at least one number from each of the k lists. We define the range [a, b] is smaller than range [c, d] if b - a < d - c or a < c if b …
633. Sum of Square Numbers
#Problem Given a non-negative integer c, decide whether there’re two integers a and b such that a² + b² = c. https://leetcode.cn/problems/sum-of-square-numbers/ Example 1: Input: c = 5 Output: true Explanation: 1 * 1 + 2 * 2 = 5 Example 2: …
638. Shopping Offers
#Problem In LeetCode Store, there are n items to sell. Each item has a price. However, there are some special offers, and a special offer consists of one or more different kinds of items with a sale price. You are given an integer array …
647. Palindromic Substrings
#Problem Given a string s, return the number of palindromic substrings in it. A string is a palindrome when it reads the same backward as forward. A substring is a contiguous sequence of characters within the string. …
661. Image Smoother
#Problem An image smoother is a filter of the size 3 x 3 that can be applied to each cell of an image by rounding down the average of the cell and the eight surrounding cells (i.e., the average of the nine cells in the blue smoother). If …