This project aims to implement a solution for rotating an n x n 2D matrix 90 degrees clockwise in Python. The provided script, main_0.py
, tests the functionality of the rotate_2d_matrix
function.
- Allowed Editors: vi, vim, emacs
- Interpretation/Compilation: Ubuntu 20.04 LTS using python3 (version 3.8.10)
- File Endings: All files should end with a new line
- First Line: The first line of all files should be exactly
#!/usr/bin/python3
- README File: A README.md file at the root of the project folder is mandatory
- Code Style: Your code should follow the pycodestyle style (version 2.8.0)
- Module Import: You are not allowed to import any module
- Documentation: All modules and functions must be documented
- Executable Files: All files must be executable
- Task: Given an n x n 2D matrix, rotate it 90 degrees clockwise.
- Prototype:
def rotate_2d_matrix(matrix):
- Output: Do not return anything. The matrix must be edited in-place.
- Assumptions: You can assume the matrix will have 2 dimensions and will not be empty.
The provided test script, main_0.py
, can be used to validate the correctness of the rotate_2d_matrix
function. Simply execute the script, and it will rotate the sample matrix and print the result.
./main_0.py
- GitHub Repository: alx-interview
- Directory: 0x07-rotate_2d_matrix
- File: 0-rotate_2d_matrix.py