File tree 2 files changed +19
-0
lines changed
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 32
32
819|[ Most Common Word] ( ./0819-most-common-word.js ) |Easy|
33
33
824|[ Goat Latin] ( ./0824-goat-latin.js ) |Easy|
34
34
831|[ Masking Personal Information] ( ./0831-masking-personal-information.js ) |Medium|
35
+ 867|[ Transpose Matrix] ( ./0867-transpose-matrix.js ) |Easy|
35
36
890|[ Find and Replace Pattern] ( ./0890-find-and-replace-pattern.js ) |Medium|
36
37
916|[ Word Subsets] ( ./0916-word-subsets.js ) |Medium|
37
38
929|[ Unique Email Addresses] ( ./0929-unique-email-addresses.js ) |Easy|
Original file line number Diff line number Diff line change
1
+ /**
2
+ * 867. Transpose Matrix
3
+ * https://leetcode.com/problems/transpose-matrix/
4
+ * Difficulty: Easy
5
+ *
6
+ * Given a matrix A, return the transpose of A.
7
+ *
8
+ * The transpose of a matrix is the matrix flipped over it's main
9
+ * diagonal, switching the row and column indices of the matrix.
10
+ */
11
+
12
+ /**
13
+ * @param {number[][] } A
14
+ * @return {number[][] }
15
+ */
16
+ var transpose = function ( A ) {
17
+ return A [ 0 ] . map ( ( _ , i ) => A . map ( j => j [ i ] ) ) ;
18
+ } ;
You can’t perform that action at this time.
0 commit comments