title: Rotate image - leetcode
body: <p>Apologies if I am asking something stupid (I'm pretty new to coding), but I didn't manage to find a clear explanation to my doubt. I came across the following problem on leetcode:</p>
  <p><em>You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise). You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation.
  Example:
  Input: matrix = [[1,2,3],[4,5,6],[7,8,9]]
  Output: [[7,4,1],[8,5,2],[9,6,3]]</em></p>
  <p>My solution is:</p>
  <pre><code>class Solution:
      def rotate(self, matrix):
          l = len(matrix)
  
          clockwise_nums = [matrix[j][i] for i in range(l) for j in range(l - 1, -1, -1)]
  
          final_array = [clockwise_nums[i:i + l] for i in range(0, len(clockwise_nums), l)]
  
          return final_array
  </code></pre>
  <p>The sheer execution (matrix rotation) works but this is not accepted as it's not in-place. But I don't really get what that means.
  Do you think my approach is way off here and I should try something different? Or is there a way to adjust my solution (was quite happy that I came up with a way to rotate the matrix)?
  Also, any tip about in-place algorithm would be much appreciated.
  Many thanks!</p>