Matrix: LeetCode Problem 867 & 766 Walkthrough(Part 2)
867. Transpose Matrix: in this problem we are asked to transpose the matrix. Meaning flip the matrix over its main diagonal, switching the matrix’s row and column indices.


Step by step:
- First we set a variable answer equal to an empty array, this will be where we store our new matrix
- We then iterate through the matrix going down each column, and adding it to our row array.
- Once each row is complete the row is added to the answer array
- Once the iteration is complete the answer array is returned
766. Toeplitz: In this problem we are given and array and asked if every diagonal from top-left to bottom-right has the same elements.

Step by step:

- Setup an empty object variable called diagonal to track the value of our diagnoals
- The key will be equal to the row index-column index. (row index- column index or diagonal[i-j], will be the same number for all elements in that row).
- The corresponding value for each key will be the number in that row.
- If we find that one of the numbers in the diagonal (if( diagonal[i-j] !== matrix[i][j])) does not match the others we return false

A second option top the same problem.
Here we iterate through each row in the matrix. We add a variable called newArray which stores the previous array (row above). We remove the last number from newArray and add the first number from the following array (row below). This should create an exact copy. If the two arrays are not the same, then we return false. Below we have a visual representation of our first iteration (where i =0).
