Leetcode

白天 夜间 首页 下载 阅读记录
  我的书签   添加书签   移除书签

Leetcode 867 Transpose Matrix

浏览 19 扫码 分享 2023-11-24 19:50:53
  • Question Link
  • Question Description
  • Implementation

    Question Link

    https://leetcode.com/problems/transpose-matrix/

    Question Description

    Return the transpose of given Array.
    image.png

    Implementation

    1. public int[][] transpose(int[][] matrix) {
    2. int height = matrix.length;
    3. int width = matrix[0].length;
    4. int[][] transpose = new int[width][height];
    5. for (int i = 0; i < height; i++) {
    6. for (int j = 0; j < width; j++) {
    7. transpose[j][i] = matrix[i][j];
    8. }
    9. }
    10. return transpose;
    11. }

    若有收获,就点个赞吧

    0 人点赞

    上一篇:
    下一篇:
    • 书签
    • 添加书签 移除书签
    • Leetcode 160 Intersection of Two Linked Lists
    • Leetcode 52. N-Queens II
    • Leetcode 867 Transpose Matrix
    • Leetcode 51. N-Queens
    • Leetcode 304. Range Sum Query 2D -Immutable
    • Leetcode 1480 Running Sum of 1d Array
    • Leetcode 1461 Check If a String Contains All Binary Codes of Size K
    • Leetcode 29. Divide Two Integers
    • Leetcode 435. Non-Overlapping Interval
    • Leetcode 318. Maximum Product of Word Lengths
    • Leetcode 238. Product of Array Except Self
    • Leetcode 217 Contains Duplicate
    • Leetcode 268 Missing Number
    • Leetcode 49 Group Anagrams
    • Leetcode 1342 Number of Steps to Reduce a Number to Zero
    • Leetcode 191 Number of 1 Bits
    • Leetcode 354 Russian Doll Envelopes
    • Leetcode 300 Longest Increasing Subsequence
    • Leetcode 32 Longest Valid Paretheses
    • Leetcode 101 Symmetric Tree
    • Leetcode 474 Ones and Zeros
    • Leetcode 647 Palindromic Substrings
    • Leetcode 152 Maximum Product Subarray
    • Leetcode 121 Best Time to Buy and Sell Stock
    • Leetcode 1 Two Sum
    • Leetcode 344 Reverse String
    • Leetcode 74 Search a 2D Matrix
    • LeetCode 322 Coin Change
    暂无相关搜索结果!

      让时间为你证明

      展开/收起文章目录

      分享,让知识传承更久远

      文章二维码

      手机扫一扫,轻松掌上读

      文档下载

      请下载您需要的格式的文档,随时随地,享受汲取知识的乐趣!
      PDF文档 EPUB文档 MOBI文档

      书签列表

        阅读记录

        阅读进度: 0.00% ( 0/0 ) 重置阅读进度

          思维导图备注