上一页 1 ··· 44 45 46 47 48 49 50 51 52 ··· 65 下一页
摘要: 最长上升子序列 给定一个长度为 $N$ 的数列,求数值严格单调递增的子序列的长度最长是多少。 输入格式 第一行包含整数 $N$。 第二行包含 $N$ 个整数,表示完整序列。 输出格式 输出一个整数,表示最大长度。 数据范围 $1 \leq N \leq 1000$,${−10}^{9} \leq \ 阅读全文
posted @ 2022-09-13 16:24 onlyblues 阅读(1260) 评论(0) 推荐(0)
摘要: 原文链接: https://www.acwing.com/file_system/file/content/whole/index/content/6489818/ 想必很多同学在接触递归算法的时候都会很困惑,比如归并排序,为什么下面的代码可以将一个序列排好序呢? 今天突然发现,递归过程的本质就是数 阅读全文
posted @ 2022-09-09 16:43 onlyblues 阅读(145) 评论(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 阅读(35) 评论(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 阅读(134) 评论(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 阅读(113) 评论(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 阅读(108) 评论(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 阅读(81) 评论(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 阅读(112) 评论(0) 推荐(0)
摘要: 列表排序 给定一个 $n$ 行 $m$ 列的整数列表。 列表中每一行的 $m$ 个整数都是一个 $1 \sim m$ 的排列。 现在,你可以对该列表执行以下两种操作: 选择一行中的两个整数并交换它们。此操作,每行最多只能执行一次。 选择列表中的两列并交换它们。此操作,最多只能执行一次。 不难发现,你 阅读全文
posted @ 2022-09-04 09:22 onlyblues 阅读(102) 评论(0) 推荐(0)
摘要: 环形石子合并 将 $n$ 堆石子绕圆形操场排放,现要将石子有序地合并成一堆。 规定每次只能选相邻的两堆合并成新的一堆,并将新的一堆的石子数记做该次合并的得分。 请编写一个程序,读入堆数 $n$ 及每堆的石子数,并进行如下计算: 选择一种合并石子的方案,使得做 $n−1$ 次合并得分总和最大。 选择一 阅读全文
posted @ 2022-09-02 20:55 onlyblues 阅读(270) 评论(0) 推荐(1)
上一页 1 ··· 44 45 46 47 48 49 50 51 52 ··· 65 下一页
Web Analytics