全站内容
Calf
这里收录 Calf 在 GoCalf 上的文章、笔记与其他内容。
297. Serialize and Deserialize Binary Tree
#Problem Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the …
2981. Find Longest Special Substring That Occurs Thrice I
#Problem You are given a string s that consists of lowercase English letters. A string is called special if it is made up of only a single character. For example, the string "abc" is not special, whereas the strings "ddd", "zz", and "f" are …
2982. Find Longest Special Substring That Occurs Thrice II
跟 2981. Find Longest Special Substring That Occurs Thrice I 一模一样,只不过 s 的长度上限从 50 增加到 5 * 10⁵。 https://leetcode.com/problems/find-longest-special-substring-that-occurs-thrice-ii/ 直接用上次的代码没问题。
3. Longest Substring Without Repeating Characters
#Problem Given a string s, find the length of the longest substring without repeating characters. A substring is a contiguous non-empty sequence of characters within a string. …
300. Longest Increasing Subsequence
#Problem Given an integer array nums, return the length of the longest strictly increasing subsequence. A subsequence is an array that can be derived from another array by deleting some or no elements without changing the order of the …
3001. Minimum Moves to Capture The Queen
#Problem There is a 1-indexed 8 x 8 chessboard containing 3 pieces. You are given 6 integers a, b, c, d, e, and f where: (a, b) denotes the position of the white rook. (c, d) denotes the position of the white bishop. (e, f) denotes the …
3019. Number of Changing Keys
#Problem You are given a 0-indexed string s typed by a user. Changing a key is defined as using a key different from the last used key. For example, s = "ab" has a change of a key while s = "bBBb" does not have any. Return the number of …
3042. Count Prefix and Suffix Pairs I
#Problem You are given a 0-indexed string array words. Let’s define a boolean function isPrefixAndSuffix that takes two strings, str1 and str2: isPrefixAndSuffix(str1, str2) returns true if str1 is both a prefix and a suffix of str2, and …
3045. Count Prefix and Suffix Pairs II
#Problem 跟 3042. Count Prefix and Suffix Pairs I 一模一样,但单词数量从 50 提升到 10⁵,同时单词的长度也从 10 提升到 10⁵。 https://leetcode.com/problems/count-prefix-and-suffix-pairs-ii/ Constraints: 1 <= words.length <= 10⁵ 1 <= words[i].length <= 10⁵ words[i] …
3046. Split the Array
#Problem You are given an integer array nums of even length. You have to split the array into two parts nums1 and nums2 such that: nums1.length == nums2.length == nums.length / 2. nums1 should contain distinct elements. nums2 should also …