package y2019.Algorithm.array;

/**
* @ProjectName: cutter-point
* @Package: y2019.Algorithm.array
* @ClassName: Transpose
* @Author: xiaof
* @Description: 867. Transpose Matrix
*
* Given a matrix A, return the transpose of A.
* The transpose of a matrix is the matrix flipped over it's main diagonal, switching the row and column indices of the matrix.
*
* Input: [[1,2,3],[4,5,6],[7,8,9]]
* Output: [[1,4,7],[2,5,8],[3,6,9]]
*
* Input: [[1,2,3],[4,5,6]]
* Output: [[1,4],[2,5],[3,6]]
*
* @Date: 2019/7/4 15:44
* @Version: 1.0
*/
public class Transpose { public int[][] solution(int[][] A) { int[][] result = new int[A[0].length][A.length];
for(int column = 0; column < A[0].length; ++column) {
//行
for(int row = 0; row < A.length; ++row) {
result[column][row] = A[row][column];
}
} return result; } }

最新文章

  1. MySQL数据库安装与配置详解
  2. 关于ecshop的那些故事
  3. SQL语句 - 基本查询
  4. 56个睿智帅气貌美的CTO大牛陪你叨逼叨
  5. JAVA 对象的转型
  6. 点击后弧形展开的炫酷菜单--第三方开源-- CircularFloatingActionMenu(一)
  7. 使用Office2007向cnblogs.com发布文章
  8. IOS 通过button获取cell
  9. 1170: 非常男女(XCOJ 前缀和)
  10. R与数据分析旧笔记(十六) 基于密度的方法:DBSCAN
  11. Bootstrap学习(一):Bootstrap简介
  12. c# WebApi之身份验证:Basic基础认证
  13. Linux巩固记录(4) 运行hadoop 2.7.4自带demo程序验证环境
  14. C#访问SQLServer数据库访问帮助类
  15. fusionjs 学习一 基本试用
  16. [转] gitlab 的 CI/CD 配置管理
  17. HDU 4585 Shaolin(水题,STL)
  18. ANE-IOS与AS的互通
  19. es6笔记4^_^function
  20. python_day4学习笔记

热门文章

  1. WinDbg常用命令系列---检查符号X
  2. windows串口编程Win32,PComm串口开发
  3. 使用RedisDesktopManager客户端无法连接Redis服务器问题解决办法
  4. MAKEFILE编写学习--1
  5. mysql 修改表名
  6. JavaScript中的内存溢出与内存泄漏
  7. Java 12 骚操作, switch居然还能这样玩!
  8. C#构建可扩展的应用程序(插件)
  9. Laravel模型事件的实现原理详解
  10. 还在用难用的AssetBundle?快来运用Unity新的可寻址资源系统,助力游戏开发