Skip to main content

All Questions

Tagged with
14 votes
4 answers
2k views

Create a snail matrix

Statement: Create a script that, given an integer \$n\$, create a square matrix of dimensions \$n \times n\$ with the numbers from \$1\$ to \$n^2\$, arranged in a snail pattern. Example: ...
Dorian Turba's user avatar
11 votes
1 answer
5k views

Matrix rotation algorithm

This is the Matrix Rotation problem from hackerrank.com. You are given a 2D matrix, \$a\$, of dimension \$M×N\$ and a positive integer \$R\$. You have to rotate the matrix R times and print the ...
benSooraj's user avatar
  • 305
7 votes
2 answers
3k views

Magic Square (Python)

Problem Write a method to return a boolean if an input grid is magic square. A magic square is a \$NxN\$ square grid (where N is the number of cells on each side) filled with distinct positive ...
Emma's user avatar
  • 3,592