Optmyzr SDE Intern OA Round - 1
Summary
I recently appeared for the Optmyzr SDE Intern Online Assessment (Round 1). I encountered an interesting problem based on 2D Matrix transformations and have shared its description and my approach.
Full Experience
I recently appeared for the Optmyzr SDE Intern Online Assessment (Round 1). One of the interesting problems was based on 2D Matrix transformations. Sharing the problem statement and my approach to help the community!
Interview Questions (1)
Matrix Transformations (Rotate & Flip)
📝 Problem Description
You are given an $N \times N$ matrix (2D vector). You need to perform a series of operations in a specific order to transform the matrix.
Operations:
- Rotation: Rotate the matrix clockwise by a given angle $\theta \in \{90^\circ, 180^\circ, 270^\circ\}$.
- Vertical Flip: If
vertical_flip == 1, flip the matrix vertically (up-to-down). - Horizontal Flip: If
horizontal_flip == 1, flip the matrix horizontally (left-to-right).
Input Format:
- A 2D vector
matrix. - An integer
angle(90, 180, or 270). - An integer
v_flip(0 or 1). - An integer
h_flip(0 or 1).