Given an array of non-empty integers, each element occurs twice except for one. Find the element that appears only once. Description: Your algorithm should have linear time complexity. Can you do this without using extra space? See the LeetCode website for an example. The copyright belongs to Lankou Network. Commercial reprint please contact the official authorization, non-commercial reprint...

Given an array of prices, the ith element of prices[I] represents the price of a given stock on day I. You can only buy the stock on a certain day and sell it on a different date in the future. Design an algorithm to calculate the maximum profit you can make. Return the maximum profit you can make from the transaction. If you can't make any profit, return 0. For an example, see Leetcode...

Given a string, verify that it is a palindrome string. Only consider alphanumeric characters. You can ignore the case of the letters. Note: In this case, we define an empty string as a valid palindrome string. See the LeetCode website for an example. The copyright belongs to Lankou Network. Commercial reprint please contact the official authorization, non-commercial reprint please indicate the source.

Description: Give you two binary strings and return their sum (in binary). The input is a non-empty string and contains only the digits 1 and 0. See the LeetCode website for an example. The copyright belongs to Lankou Network. Commercial reprint please contact the official authorization, non-commercial reprint please indicate the source.

Diameter points of a binary tree: what the root node needs to do is to add the height of the left subtree and the right subtree, and then add 1 to get the diameter length of the node. An intermediate variable Max is used to record the longest diameter, and the final Max is the result. Calculate the diameter: 1. Get the height of the left subtree 2. Get the height of the right subtree 3. Add 1.

NumRows = NumRows = NumRows = NumRows = NumRows = NumRows = NumRows = NumRows = NumRows In the Yang Hui Triangle, each number is the sum of the numbers at the upper left and the upper right of it. See the LeetCode website for an example. The copyright belongs to Lankou Network. Commercial reprint please contact the official authorization, non-commercial reprint please indicate the source.

Description: Given a non-negative index k, where k ≤ 33, return the KTH row of the Yanghui Triangle. In the Yang Hui Triangle, each number is the sum of the numbers at the upper left and the upper right of it. See the LeetCode website for an example. The copyright belongs to Lankou Network. Commercial reprint please contact the official authorization, non-commercial reprint please indicate the source.

Given the root node of the binary tree, return the pre-order traversal of its node values. See the LeetCode website for an example. The copyright belongs to Lankou Network. Commercial reprint please contact the official authorization, non-commercial reprint please indicate the source.

Important: The diameter of a binary tree is the maximum number of nodes formed by the left and right subtrees and the root node minus one. Set an intermediate variable Max, and compare the number of nodes formed by left and right subtrees and root nodes with Max each time. Save the larger node with Max until the longest node path formed by all left and right subtrees and root nodes is Max, and the maximum diameter is Max with max-1 finally. And the essence of this problem is to find the depth of the tree.

Description: There is a linked list in ascending order. Given the head node of the linked list, please delete all duplicate elements so that each element appears only once. Returns the resulting list, also in ascending order. See the LeetCode website for an example. The copyright belongs to Lankou Network. Commercial reprint please contact the official authorization, non-commercial reprint please indicate the source.