上一页 1 ··· 42 43 44 45 46 47 48 49 50 ··· 63 下一页
摘要: 原文链接: https://www.acwing.com/file_system/file/content/whole/index/content/6489818/ 想必很多同学在接触递归算法的时候都会很困惑,比如归并排序,为什么下面的代码可以将一个序列排好序呢? 今天突然发现,递归过程的本质就是数 阅读全文
posted @ 2022-09-09 16:43 onlyblues 阅读(129) 评论(0) 推荐(0)
摘要: Evaluate Division You are given an array of variable pairs equations and an array of real numbers values , where equations[i] = [Ai, Bi] and values[i] 阅读全文
posted @ 2022-09-07 21:23 onlyblues 阅读(30) 评论(0) 推荐(0)
摘要: Count Unique Characters of All Substrings of a Given String Let's define a function countUniqueChars(s) that returns the number of unique characters o 阅读全文
posted @ 2022-09-06 16:16 onlyblues 阅读(124) 评论(0) 推荐(0)
摘要: Meeting Rooms III You are given an integer $n$. There are $n$ rooms numbered from $0$ to $n - 1$. You are given a 2D integer array meetings where meet 阅读全文
posted @ 2022-09-05 23:19 onlyblues 阅读(110) 评论(0) 推荐(0)
摘要: Number of Ways to Reach a Position After Exactly k Steps You are given two positive integers startPos and endPos . Initially, you are standing at posi 阅读全文
posted @ 2022-09-05 20:16 onlyblues 阅读(96) 评论(0) 推荐(0)
摘要: Maximum Number of Robots Within Budget You have $n$ robots. You are given two 0-indexed integer arrays, chargeTimes and runningCosts , both of length 阅读全文
posted @ 2022-09-04 21:47 onlyblues 阅读(67) 评论(0) 推荐(0)
摘要: 串联数字 给定 $n$ 个正整数 $a_1,a_2, \dots ,a_n$。 我们规定将正整数 $a_i$ 和 $a_j$ 串联是指将 $a_j$ 直接接在 $a_i$ 后面构成一个新整数。 例如,$12$ 和 $34$ 串联得到 $1234$,$34$ 和 $12$ 串联得到 $3412$。 现 阅读全文
posted @ 2022-09-04 16:23 onlyblues 阅读(102) 评论(0) 推荐(0)
摘要: 列表排序 给定一个 $n$ 行 $m$ 列的整数列表。 列表中每一行的 $m$ 个整数都是一个 $1 \sim m$ 的排列。 现在,你可以对该列表执行以下两种操作: 选择一行中的两个整数并交换它们。此操作,每行最多只能执行一次。 选择列表中的两列并交换它们。此操作,最多只能执行一次。 不难发现,你 阅读全文
posted @ 2022-09-04 09:22 onlyblues 阅读(94) 评论(0) 推荐(0)
摘要: 环形石子合并 将 $n$ 堆石子绕圆形操场排放,现要将石子有序地合并成一堆。 规定每次只能选相邻的两堆合并成新的一堆,并将新的一堆的石子数记做该次合并的得分。 请编写一个程序,读入堆数 $n$ 及每堆的石子数,并进行如下计算: 选择一种合并石子的方案,使得做 $n−1$ 次合并得分总和最大。 选择一 阅读全文
posted @ 2022-09-02 20:55 onlyblues 阅读(256) 评论(0) 推荐(1)
摘要: 石子合并 设有 $N$ 堆石子排成一排,其编号为 $1,2,3, \dots ,N$。 每堆石子有一定的质量,可以用一个整数来描述,现在要将这 $N$ 堆石子合并成为一堆。 每次只能合并相邻的两堆,合并的代价为这两堆石子的质量之和,合并后与这两堆石子相邻的石子将和新堆相邻,合并时由于选择的顺序不同, 阅读全文
posted @ 2022-08-31 21:30 onlyblues 阅读(363) 评论(0) 推荐(0)
上一页 1 ··· 42 43 44 45 46 47 48 49 50 ··· 63 下一页
Web Analytics