精選分類

文章列表

1.4k 1 分鐘

⭐️⭐️⭐️⭐️ # 題目敘述 Given two arrays nums1 and nums2 . Return the maximum dot product between non-empty subsequences of nums1 and nums2 with the same length. A subsequence of a array is a new array which is formed from the original array by deleting some (can be none) of the characters without...
1.4k 1 分鐘

⭐️ # 題目敘述 Given the root of a binary tree, split the binary tree into two subtrees by removing one edge such that the product of the sums of the subtrees is maximized. Return the maximum product of the sums of the two subtrees. Since the answer may be too large, return it modulo 10^9 + 7 . Note that...
1.1k 1 分鐘

⭐️ # 題目敘述 You are given an n x n integer matrix . You can do the following operation any number of times: Choose any two adjacent elements of matrix and multiply each of them by -1 . Two elements are considered adjacent if and only if they share a border. Your goal is to maximize the summation of...
540 1 分鐘

⭐️ # 題目敘述 Given an integer array nums , return the sum of divisors of the integers in that array that have exactly four divisors. If there is no such integer in the array, return 0 . # Example 1 Input: nums = [21,4,7] Output: 32 Explanation: 21 has 4 divisors: 1, 3, 7, 21 4 has 3 divisors: 1, 2,...
1.2k 1 分鐘

⭐️⭐️⭐️ # 題目敘述 You have a grid of size n x 3 and you want to paint each cell of the grid with exactly one of the three colors: Red, Yellow, or Green while making sure that no two adjacent cells have the same color (i.e., no two cells that share vertical or horizontal sides have the same color). Given...
975 1 分鐘

⭐️ # 題目敘述 You are given an integer array nums with the following properties: nums.length == 2 * n . nums contains n + 1 unique elements. Exactly one element of nums is repeated n times. Return the element that is repeated n times. # Example 1 Input: nums = [1,2,3,3] Output: 3 # Example 2 Input:...
1.1k 1 分鐘

⭐️ # 題目敘述 You are given a large integer represented as an integer array digits , where each digits[i] is the ith digit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain any leading 0 's. Increment the...
5.1k 5 分鐘

# 安裝 C++ 等套件 sudo apt install build-essential# 安裝 java 默認 JRE/JDK # 更新包sudo apt update# 檢查 java 是否已經安裝過java --version# 安裝默認 JREsudo apt install default-jre# 安裝默認 JDKsudo apt install default-jdk# 檢查 javac,java 編譯器版本javac --version剛安裝好的 Ubuntu 系統裡的套件版本與安全性更新可能已經舊了,通常會先做這兩步: sudo apt update #...
1.7k 2 分鐘

⭐️ # 題目敘述 You are given a 2D 0-indexed integer array dimensions . For all indices i , 0 <= i < dimensions.length , dimensions[i][0] represents the length and dimensions[i][1] represents the width of the rectangle i . Return the area of the rectangle having the longest diagonal. If...