2D Arrays
Today, I solved the Rotate Image by 90° Clockwise problem. Initially, I attempted to solve it using extra space, but then I tried to optimize it without using additional space. Although I couldn't fully optimize it without space yet, it was a valuable learning experience. Before this, I had learned about row-major and column-major ordering and how data is stored. While databases typically use column-major order, the actual in-memory storage of a matrix is in a linear form, not organized in row-major or column-major order. This means the matrix is stored as a contiguous block of memory, and we can calculate the corresponding index for an element using its position in this linearized structure. I also practiced matrix transposition: First, I transposed the matrix using extra space. Then, I learned how to transpose a matrix without extra space by swapping elements in place. Additionally, I learned how to reverse rows in a matrix without using extra space. This was a great exercise in optimizing space complexity while performing matrix manipulations. Happy coding!

Today, I solved the Rotate Image by 90° Clockwise problem. Initially, I attempted to solve it using extra space, but then I tried to optimize it without using additional space. Although I couldn't fully optimize it without space yet, it was a valuable learning experience.
Before this, I had learned about row-major and column-major ordering and how data is stored. While databases typically use column-major order, the actual in-memory storage of a matrix is in a linear form, not organized in row-major or column-major order. This means the matrix is stored as a contiguous block of memory, and we can calculate the corresponding index for an element using its position in this linearized structure.
I also practiced matrix transposition:
First, I transposed the matrix using extra space.
Then, I learned how to transpose a matrix without extra space by swapping elements in place.
Additionally, I learned how to reverse rows in a matrix without using extra space. This was a great exercise in optimizing space complexity while performing matrix manipulations.
Happy coding!