首页 > 最长递增子序列
头像 _Bingbong
发表于 2024-12-31 23:49:16
解题思路 这是一个最长上升子序列(LIS)问题,使用二分查找优化。关键点: 贪心策略: 维护一个递增数组 表示长度为 的上升子序列的最小末尾元素 二分查找: 对于每个数字,在 中找到第一个大于它的位置 更新该位置的值为当前数字 结果: 数组的长度就是最长上升子序列的长 展开全文
头像 Danzo123
发表于 2026-02-09 23:47:37
使用动态规划解决该问题 import java.util.*; public class AscentSequence { public int findLongest(int[] A, int n) { // write code here if(n == 展开全文
头像 用心的布莱克刷牛客
发表于 2025-05-21 13:38:07
#include <algorithm> class AscentSequence { public: int findLongest(vector<int> A, int n) { // write code here //原版LIS 展开全文

等你来战

查看全部