【发布时间】:2021-08-29 13:59:06
【问题描述】:
我们有一个由 M 行组成的 2D 矩阵 A,其中每一行都填充了从 1 到 N (A[M][ N])
我们要确定矩阵所有行中最长公共子数组的长度
例子:
A = {{1,2,3,4},{3,4,1,2},{3,1,2,4}}
Longest common Subarray {1,2}
Length of LCS = 2
Output = 2
我不需要代码只是一个优化建议。
【问题讨论】:
-
阅读tour 和How to Ask。 StackOverflow 不是代码编写服务,因此您应该编辑您的诚实尝试,将其作为minimal reproducible example 编码到您的问题中。
-
您是否尝试过以下解决方案?对你有帮助吗?
标签: c algorithm data-structures array-algorithms