class Solution: def smallestEvenMultiple(self, n: int) -> int: if n & 1: # 如果 n 是奇数,则 2 和 n 的最小公倍数为 2n return n << 1 # 如果 n 是偶数,则 2 和 n 的最小公倍数为 n return n 代码(Go) func smallestEvenMultiple(n int) int { if n & 1 == 1 { // 如果...
`2413-Smallest-Even-Multiple.py` 是一个使用 Python 编写的 LeetCode 题目解法,题目编号为 2413。这个题目要求我们找到一个数,使得它与给定的偶数相乘的结果最小。 解题思路: 1. 首先,我们需要找到给定的偶数的平方根。 2. 然后,我们可以遍历从 0 到该平方根的所有整数,检查它们是否为偶数。 3. 如果找到了...
2409Count Days Spent TogetherPythonUse month as a day 2413Smallest Even MultiplePythonCheck the n is multiply by 2 2429Minimize XORPythoncheck the num1, num2 with length and replace "0" compare with num1.
988 Smallest String Starting From Leaf 46.60% Medium 987 Vertical Order Traversal of a Binary Tree 37.60% Medium 986 Interval List Intersections 68.10% Medium 985 Sum of Even Numbers After Queries 60.70% Easy 984 String Without AAA or BBB 38.50% Medium 983 Minimum Cost For Tickets 62.60% Medium...
You may not engage in multiple transactions at the same time (ie, you must sell the stock before you buy again). After you sell your stock, you cannot buy stock on next day. (ie, cooldown 1 day) Example: 代码语言:javascript 代码运行次数:0 复制Cloud Studio 代码运行 prices = [1, 2...
440 K-th Smallest in Lexicographical Order 26.3% Hard 441 Arranging Coins 37.6% Easy 442 Find All Duplicates in an Array 60.1% Medium 443 String Compression 37.0% Easy 445 Add Two Numbers II 49.5% Medium 446 Arithmetic Slices II – Subsequence 29.9% Hard 447 Number of Boomerangs 49.4% Easy...
During even-numbered jumps (i.e., jumps 2, 4, 6, ...), you jump to the indexjsuch thatarr[i] >= arr[j]andarr[j]is the largest possible value. If there are multiple such indicesj, you can only jump to the smallest such indexj. ...
988 Smallest String Starting From Leaf 46.60% Medium 987 Vertical Order Traversal of a Binary Tree 37.60% Medium 986 Interval List Intersections 68.10% Medium 985 Sum of Even Numbers After Queries 60.70% Easy 984 String Without AAA or BBB 38.50% Medium 983 Minimum Cost For Tickets 62.60% Medium...
If there are multiple score values satisfying the above conditions, choose the smallest one. If the input data is not enough to determine the score, report -1. Return the result table in any order. The query result format is in the following example. Example 1: Input: Schools table: +-...
302 Smallest Rectangle Enclosing Black Pixels Solution ? O(m*n) Hard DFS, BFS 303 Range Sum Query - Immutable Solution O(n) O(1) Easy 304 Range Sum Query 2D - Immutable Solution ? ? Medium 305 Number of Islands II Solution ? ? Hard Union Find 306 Additive Number Solution O(n^2...