Open sujana-kamasany opened 2 years ago
My sol: public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); int[][] arr = new int[n][m]; // Initializing a 2d array for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { arr[i][j] = in.nextInt(); } } //Main operation. for(int i = 0 ; i < n; i++){ for(int j = i ; j < m ; j++){ if(i != j){ int temp = arr[i][j]; arr[i][j] = arr[j][i]; arr[j][i] = temp; } } } System.out.println(Arrays.deepToString(arr)); }
@DHARUNKUMAR7 Thank you for your solution ! Please go ahead and make a pull request
Look at my repo Matrix, is an API in java language for work with matrixes.
Look at my repo Matrix, is an API in java language for work with matrixes.
@matteopagano sure ! Thanks for sharing this
Hey, I want to work on this please assign me
Hey, I want to work on this please assign me
Sure ! Please submit your solution
Java Program to Find Transpose of a Matrix