diff --git a/867. Transpose Matrix b/867. Transpose Matrix new file mode 100644 index 0000000..d21fe6c --- /dev/null +++ b/867. Transpose Matrix @@ -0,0 +1,15 @@ +class Solution { +public: + vector> transpose(vector>& matrix) { + int row = matrix.size(); + int col = matrix[0].size(); + // Create Transpose Matrix + vector> ans(col, vector(row, 0)); + // Insert In Transpose Matrix + for (int i = 0; i < row; i++) + for(int j = 0; j < col; j++) + ans[j][i] = matrix[i][j]; + + return ans; + } +};