Skip to content

Commit 949dd89

Browse files
committed
add rotate image
1 parent cb16d94 commit 949dd89

File tree

1 file changed

+60
-2
lines changed

1 file changed

+60
-2
lines changed

rotate-image/README.md

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,62 @@
1+
## [Transpose](http://en.wikipedia.org/wiki/Transpose) then Reverse
12

2-
## TODO
3-
* write down thinking
3+
You must know this method, or it is difficult.
44

5+
```
6+
+---+---+
7+
| 1 | 2 |
8+
+---+---+
9+
| 3 | 4 |
10+
+---+---+
11+
```
12+
13+
Transpose: reflect the matrix over the main diagonal.
14+
15+
16+
```
17+
Before
18+
19+
+
20+
+---+---+
21+
| + | 2 |
22+
+---+---+
23+
| 3 | + |
24+
+---+---+
25+
+
26+
27+
After
28+
29+
+
30+
+---+---+
31+
| 1 | 3 |
32+
+---+---+
33+
| 2 | 4 |
34+
+---+---+
35+
+
36+
```
37+
38+
Reverse: exchange each number along the vertical line in the middle
39+
40+
```
41+
Before
42+
43+
|
44+
+---+---+
45+
| 1 | 3 |
46+
+---+---+
47+
| 2 | 4 |
48+
+---+---+
49+
|
50+
51+
52+
After
53+
54+
|
55+
+---+---+
56+
| 3 | 1 |
57+
+---+---+
58+
| 4 | 2 |
59+
+---+---+
60+
|
61+
62+
```

0 commit comments

Comments
 (0)