全站内容
Calf
这里收录 Calf 在 GoCalf 上的文章、笔记与其他内容。
2270. Number of Ways to Split Array
#Problem You are given a 0-indexed integer array nums of length n. nums contains a valid split at index i if the following are true: The sum of the first i + 1 elements is greater than or equal to the sum of the last n - i - 1 elements. …
2274. Maximum Consecutive Floors Without Special Floors
#Problem Alice manages a company and has rented some floors of a building as office space. Alice has decided some of these floors should be special floors, used for relaxation only. You are given two integers bottom and top, which denote …
2275. Largest Combination With Bitwise AND Greater Than Zero
#Problem The bitwise AND of an array nums is the bitwise AND of all integers in nums. For example, for nums = [1, 5, 3], the bitwise AND is equal to 1 & 5 & 3 = 1. Also, for nums = [7], the bitwise AND is 7. You are given an array of …
2290. Minimum Obstacle Removal to Reach Corner
#Problem You are given a 0-indexed 2D integer array grid of size m x n. Each cell has one of two values: 0 represents an empty cell, 1 represents an obstacle that may be removed. You can move up, down, left, or right from and to an empty …
2296. Design a Text Editor
#Problem Design a text editor with a cursor that can do the following: Add text to where the cursor is. Delete text from where the cursor is (simulating the backspace key). Move the cursor either left or right. When deleting text, only …
23. Merge k Sorted Lists
#Problem You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one sorted linked-list and return it. https://leetcode.com/problems/merge-k-sorted-lists/ Example 1: …
230. Kth Smallest Element in a BST
#Problem Given the root of a binary search tree, and an integer k, return the kᵗʰ smallest value (1-indexed) of all the values of the nodes in the tree. https://leetcode.com/problems/kth-smallest-element-in-a-bst/ Example 1: case1Input: …
2337. Move Pieces to Obtain a String
#Problem You are given two strings start and target, both of length n. Each string consists only of the characters 'L', 'R', and '_' where: The characters 'L' and 'R' represent pieces, where a piece 'L' can move to the left only if there is …
2342. Max Sum of a Pair With Equal Sum of Digits
#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 …
2349. Design a Number Container System
#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: …