File tree Expand file tree Collapse file tree 1 file changed +0
-41
lines changed
src/main/java/com/fishercoder/solutions Expand file tree Collapse file tree 1 file changed +0
-41
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import com .fishercoder .common .utils .CommonUtils ;
4
4
5
- /**
6
- * 48. Rotate Image
7
-
8
- You are given an n x n 2D matrix representing an image.
9
-
10
- Rotate the image by 90 degrees (clockwise).
11
-
12
- Note:
13
- You have to rotate the image in-place, which means you have to modify the
14
- input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation.
15
-
16
- Example 1:
17
- Given input matrix =
18
- [
19
- [1,2,3],
20
- [4,5,6],
21
- [7,8,9]
22
- ],
23
- rotate the input matrix in-place such that it becomes:
24
- [
25
- [7,4,1],
26
- [8,5,2],
27
- [9,6,3]
28
- ]
29
-
30
- Example 2:
31
- Given input matrix =
32
- [
33
- [ 5, 1, 9,11],
34
- [ 2, 4, 8,10],
35
- [13, 3, 6, 7],
36
- [15,14,12,16]
37
- ],
38
- rotate the input matrix in-place such that it becomes:
39
- [
40
- [15,13, 2, 5],
41
- [14, 3, 4, 1],
42
- [12, 6, 8, 9],
43
- [16, 7,10,11]
44
- ]
45
- */
46
5
public class _48 {
47
6
48
7
/**Note: this is an n*n matrix, in other words, it's a square, this makes it easier as well.*/
You can’t perform that action at this time.
0 commit comments