全站内容
Calf
这里收录 Calf 在 GoCalf 上的文章、笔记与其他内容。
664. Strange Printer
#Problem There is a strange printer with the following two special properties: The printer can only print a sequence of the same character each time. At each turn, the printer can print new characters starting from and ending at any place …
674. Longest Continuous Increasing Subsequence
#Problem Given an unsorted array of integers nums, return the length of the longest continuous increasing subsequence (i.e. subarray). The subsequence must be strictly increasing. A continuous increasing subsequence is defined by two …
680. Valid Palindrome II
#Problem Given a string s, return true if the s can be palindrome after deleting at most one character from it. https://leetcode.cn/problems/valid-palindrome-ii/ Example 1: Input: s = "aba" Output: true Example 2: Input: s = "abca" Output: …
684. Redundant Connection
#Problem In this problem, a tree is an undirected graph that is connected and has no cycles. You are given a graph that started as a tree with n nodes labeled from 1 to n, with one additional edge added. The added edge has two different …
685. Redundant Connection II
#Problem In this problem, a rooted tree is a directed graph such that, there is exactly one node (the root) for which all other nodes are descendants of this node, plus every node has exactly one parent, except for the root node which has …
688. Knight Probability in Chessboard
#Problem On an n x n chessboard, a knight starts at the cell (row, column) and attempts to make exactly k moves. The rows and columns are 0-indexed, so the top-left cell is (0, 0), and the bottom-right cell is (n - 1, n - 1). A chess knight …
689. Maximum Sum of 3 Non-Overlapping Subarrays
#Problem Given an integer array nums and an integer k, find three non-overlapping subarrays of length k with maximum sum and return them. Return the result as a list of indices representing the starting position of each interval …
70. Climbing Stairs
#Problem You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? https://leetcode.com/problems/climbing-stairs/ Example 1: Input: n = …
714. Best Time to Buy and Sell Stock with Transaction Fee
#Problem You are given an array prices where prices[i] is the price of a given stock on the iᵗʰ day, and an integer fee representing a transaction fee. Find the maximum profit you can achieve. You may complete as many transactions as you …
72. Edit Distance
#Problem Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2. You have the following three operations permitted on a word: Insert a character Delete a character Replace a character …