如何拆分矩阵,然后使用JavaScript显示其最小值和最大值?
我有一个矩阵,
const matrix = [
[1,5,7],
[7,3,5],
[2,6,9]
];
我想将其分成子量表,
[
[1,5],
[7,3]
]
[
[5,7],
[3,5]
]
[
[7,3],
[2,6]
]
[
[3,5],
[6,9]
]
中获取最大值
[
[7,7],
[7,9]
]
然后我想从子词和最小值
[
[1,3],
[2,3]
]
。我该如何处理?
I have a matrix
const matrix = [
[1,5,7],
[7,3,5],
[2,6,9]
];
I would like to split it into sub-matrices
[
[1,5],
[7,3]
]
[
[5,7],
[3,5]
]
[
[7,3],
[2,6]
]
[
[3,5],
[6,9]
]
Then I want to get the maximum values from the sub-matrices
[
[7,7],
[7,9]
]
and also the minimum values.
[
[1,3],
[2,3]
]
How can I approach this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于未指定原始矩阵的尺寸和子膜的尺寸,因此我以示例中给出的尺寸:
Since the dimensions of the original matrix and the dimensions of the submatrices are not specified, I took the ones given in the example: