top of page

Looking to master object-oriented and system design for tech interviews or career growth?

  • Improve your system design and machine coding skills.

  • Study with our helpful resources.

  • Prepare for technical interviews and advance your career.

**We're in beta mode and would love to hear your feedback.

Rotate Matrix - Interviewbit Solution

Problem: Rotate Matrix


Problem Description:

You are given an n x n 2D matrix representing an image.

Rotate the image by 90 degrees (clockwise).

You need to do this in place.

Note that if you end up using an additional array, you will only receive partial score.


Example:

If the array is

[     
    [1, 2],     
    [3, 4] 
] 

Then the rotated array becomes:

[     
    [3, 1],     
    [4, 2] 
]

Solution:


bottom of page