Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize transpose Matrix by leetcode

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces leetcode how to achieve the transpose matrix, the article introduces in great detail, has a certain reference value, interested friends must read it!

I. the content of the topic

Give you a two-dimensional integer array matrix and return the transpose matrix of matrix.

The transpose of the matrix refers to the flipping of the main diagonal of the matrix and the row index and column index of the fabric.

Example 1:

Input: matrix = [1, 2, 3], [4, 5, 5, 6], [7, 8, 9]]

Output: [[1pd4, 7], [2, 5, 8], [3, 6, 9]]

Example 2:

Input: matrix = [[1Jing 2jue 3], [4Jing 5jue 6]]

Output: [1, 4], [2, 5], [3, 6]]

Tip:

M = = matrix.length

N = = matrix [I] .length

one

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report