全站内容
Calf
这里收录 Calf 在 GoCalf 上的文章、笔记与其他内容。
105. Construct Binary Tree from Preorder and Inorder Traversal
#Problem Given two integer arrays preorder and inorder where preorder is the preorder traversal of a binary tree and inorder is the inorder traversal of the same tree, construct and return the binary tree. …
1072. Flip Columns For Maximum Number of Equal Rows
#Problem You are given an m x n binary matrix matrix. You can choose any number of columns in the matrix and flip every cell in that column (i.e., Change the value of the cell from 0 to 1 or vice versa). Return the maximum number of rows …
1079. Letter Tile Possibilities
#Problem You have n tiles, where each tile has one letter tiles[i] printed on it. Return the number of possible non-empty sequences of letters you can make using the letters printed on those tiles. …
1092. Shortest Common Supersequence
#Problem Given two strings str1 and str2, return the shortest string that has both str1 and str2 as subsequences. If there are multiple valid strings, return any of them. A string s is a subsequence of string t if deleting some number of …
11. Container With Most Water
#Problem You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]). Find two lines that together with the x-axis form a container, such that …
1128. Number of Equivalent Domino Pairs
#Problem Given a list of dominoes, dominoes[i] = [a, b] is equivalent to dominoes[j] = [c, d] if and only if either (a == c and b == d), or (a == d and b == c) - that is, one domino can be rotated to be equal to another domino. Return the …
1143. Longest Common Subsequence
#Problem Given two strings text1 and text2, return the length of their longest common subsequence. If there is no common subsequence, return 0. A subsequence of a string is a new string generated from the original string with some …
118. Pascal’s Triangle
#Problem Given an integer numRows, return the first numRows of Pascal’s triangle. In Pascal’s triangle, each number is the sum of the two numbers directly above it as shown: https://leetcode.cn/problems/pascals-triangle/ pascalExample 1: …
1186. Maximum Subarray Sum with One Deletion
#Problem Given an array of integers, return the maximum sum for a non-empty subarray (contiguous elements) with at most one element deletion. In other words, you want to choose a subarray and optionally delete one element from it so that …
119. Pascal's Triangle II
#Problem Given an integer rowIndex, return the rowIndexᵗʰ (0-indexed) row of the Pascal’s triangle. In Pascal’s triangle, each number is the sum of the two numbers directly above it as shown: …