Problem:
Construct a square matrix with a size N × N containing integers from 1 to N * N in a spiral order, starting from top-left and in clockwise direction.
Example
For n = 3, the output should be
-Summary-
1. Create N*N matrix filled with zeros
2. Create a dx and dy position and loop through each position filled the numbers
이해가 잘 가지 않는 문제라 사람들의 discussion 과 솔루션을 참조하였다. 항상 matrix 문제가 제일 까다롭고 복잡한것 같다.
모든 문제에 대한 저작권은 CodeSignal 회사에 있습니다. [Copyright © 2020 BrainFights Inc. All rights reserved]
'CodeSignal > Arcade' 카테고리의 다른 글
CodeSignal [60/60] sudoku (0) | 2020.05.28 |
---|---|
CodeSignal [58/60] messageFromBinaryCode (0) | 2020.05.28 |
CodeSignal [57/60] fileNaming (0) | 2020.05.28 |
CodeSignal [56/60] digitsProduct (0) | 2020.05.28 |
CodeSignal [55/60] differentSquares (0) | 2020.05.28 |
댓글