KT
kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* Challenge by Непряхин Даниил
https://www.sololearn.com/Discuss/1088989
[CHALLENGE] Matrix Rotation
The task is. You have a Matrix NxN. You should rotate it on 90 degrees.
Example:
N = 3
Input:
1 2 3
4 5 6
7 8 9
Output:
7 4 1
8 5 2
9 6 3
Levels:
1) just rotate matrix
2) matrix is 1D array (1 2 3 4 5 6 7 8 9)
3) input and output is the same memory block (the same array)
*/
import java.util.Random
val random = Random()
// Get a random number in the range
fun rand(from: Int, to: Int) = random.nextInt(to-from+1)+from
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run