File tree 1 file changed +23
-2
lines changed
1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -56,13 +56,13 @@ class Solution:
56
56
57
57
for i in range (n):
58
58
# @pointer(nums)
59
- # 看���上面的注解会插入一行
59
+ # 3. 看到上面的注解会插入一行
60
60
left = i + 1
61
61
drawGraph({ pointer: {
62
62
nums: left
63
63
}}, nums, target)
64
64
# @pointer(nums)
65
- # 看到上面的注解会插入一行
65
+ # 4. 看到上面的注解会插入一行
66
66
right = n - 1
67
67
drawGraph({ pointer: {
68
68
nums: right
@@ -81,14 +81,35 @@ class Solution:
81
81
return res
82
82
```
83
83
84
+ 第一步之后大概会生成这样的图:
85
+
86
+ ![ ] ( https://tva1.sinaimg.cn/large/007S8ZIlly1gfu805nd4mj30ol07taag.jpg )
87
+
88
+ 第二步之后大概会生成这样的图:
89
+
90
+ ![ ] ( https://tva1.sinaimg.cn/large/007S8ZIlly1gfu7zjlxbfj30lr056wes.jpg )
91
+
92
+ 第三步之后大概会生成这样的图:
93
+
94
+ ![ ] ( https://tva1.sinaimg.cn/large/007S8ZIlly1gfu813p4tij30m208d74s.jpg )
95
+
96
+ 第四步之后大概会生成这样的图:
97
+
98
+ ![ ] ( https://tva1.sinaimg.cn/large/007S8ZIlly1gfu81iyc9rj30qh0an750.jpg )
99
+
100
+ 之后每次当 left 和 right 发生变化的时候更新图片(指针变化)即可。
101
+
84
102
drawGraph 的伪代码:
85
103
86
104
``` py
105
+ def makeObseravle (any , cb ):
106
+ if changed(any ): cb
87
107
def draw (options , shape ):
88
108
if is_array(shape) {
89
109
pointer = options.pointer[shape.getName()]
90
110
if :
91
111
pointTo(shape, pointer)
112
+ makeObseravle(pointer, draw)
92
113
}
93
114
if ...
94
115
def drawGraph (options , ...shapes ):
You can’t perform that action at this time.
0 commit comments