上一页 1 ··· 43 44 45 46 47 48 49 50 51 ··· 65 下一页
摘要: Longest Subarray With Maximum Bitwise AND You are given an integer array nums of size $n$. Consider a non-empty subarray from nums that has the maximu 阅读全文
posted @ 2022-09-25 16:07 onlyblues 阅读(86) 评论(0) 推荐(0)
摘要: 旅行 给定一个 $n$ 个节点的树,节点编号为 $1 \sim n$。 请你从中选择一个简单路径(不能包含重复节点或重复的边),并沿所选路径来一场旅行,更具体的说,就是从所选路径的一个端点沿路径前往另一个端点。 注意,所选简单路径可以只由一个节点组成。 旅行需要花费能量。 初始时,你的能量为 $0$ 阅读全文
posted @ 2022-09-25 15:08 onlyblues 阅读(70) 评论(0) 推荐(0)
摘要: 减法操作 给定一个包含 $n$ 个非负整数的数列 $a_1,a_2, \dots ,a_n$。 你可以对该数列进行以下两种减法操作: 任选其中一个元素,并将该元素的值减去 $2$。 任选两个相邻元素,并将两个元素的值各减去 $1$。 请你判断,能否经过一系列减法操作,使得数列中的所有元素都变为 $0 阅读全文
posted @ 2022-09-25 14:05 onlyblues 阅读(108) 评论(0) 推荐(0)
摘要: 分成互质组 给定 $n$ 个正整数,将它们分组,使得每组中任意两个数互质。 至少要分成多少个组? 输入格式 第一行是一个正整数 $n$。 第二行是 $n$ 个不大于 $10000$ 的正整数。 输出格式 一个正整数,即最少需要的组数。 数据范围 $1 \leq n \leq 10$ 输入样例: 6 阅读全文
posted @ 2022-09-21 21:03 onlyblues 阅读(575) 评论(0) 推荐(0)
摘要: Sum of Prefix Scores of Strings You are given an array words of sizeco $n$ sisting of non-empty strings. We define the score of a string word as the n 阅读全文
posted @ 2022-09-19 20:43 onlyblues 阅读(102) 评论(0) 推荐(0)
摘要: Minimum Money Required Before Transactions You are given a 0-indexed 2D integer array transactions , where transactions[i] = [costi, cashbacki] . The 阅读全文
posted @ 2022-09-19 19:44 onlyblues 阅读(64) 评论(0) 推荐(0)
摘要: Smallest Subarrays With Maximum Bitwise OR You are given a 0-indexed array nums of length $n$, consisting of non-negative integers. For each index $i$ 阅读全文
posted @ 2022-09-18 19:36 onlyblues 阅读(91) 评论(0) 推荐(0)
摘要: 解方程 给定一个非负整数 $a$,请你计算方程 $a−(a \oplus x)−x=0$ 的非负整数解的数量。 其中 $\oplus$ 指按位异或。 输入格式 第一行包含整数 $T$,表示共有 $T$ 组测试数据。 每组数据占一行,包含一个非负整数 $a$。 输出格式 每组数据输出一行结果,一个整数 阅读全文
posted @ 2022-09-18 15:43 onlyblues 阅读(190) 评论(0) 推荐(0)
摘要: 击中战舰 李华在玩一款叫做《海战》的小游戏,下面是游戏介绍。 给定一个 $1 \times n$ 的方格矩阵,方格从左到右依次编号为 $1 \sim n$。 在这个方格矩阵中,隐藏着 $a$ 个战舰。 每个战舰都占据 $b$ 个连续的方格,每个方格最多只能被一个战舰占据。 每个战舰的具体位置未知。 阅读全文
posted @ 2022-09-18 09:16 onlyblues 阅读(50) 评论(0) 推荐(0)
摘要: 匹配价值 给定一个字符串集合 $S$,$S$ 中包含 $m$ 个长度为 $n$ 的 $01$ 字符串,集合中可能包含重复元素。 给定一个长度为 $n$ 的整数序列 $w_1,w_2, \dots ,w_n$。 关于两个长度为 $n$ 的 $01$ 字符串 $s,t$ 的匹配价值 $V$,其具体计算方 阅读全文
posted @ 2022-09-14 09:02 onlyblues 阅读(65) 评论(0) 推荐(0)
上一页 1 ··· 43 44 45 46 47 48 49 50 51 ··· 65 下一页
Web Analytics