我们来看看这张地图,其中'#'表示一个正方形和'.' 说明了一个自由方块:
1 . # # # . . 2 . # . . # . 3 # . . . . # 4 . # # # . . 5 . . . . . . 6 . . . . . . - 1 2 3 4 5 6
现在,如果我在方块4,5中放置一个'#',那么该区域将被"填充",如下所示:
1 . # # # . . 2 . # # # # . 3 # # # # # # 4 . # # # # . …
在没有任何适当解决方案的情况下,我一直在努力解决这个图表演示问题.也许有人可以解决问题.
我有一个连接的,无循环图的演示文稿,形式如下:
下面是一个示例图:
2 3
\ /
5 1
\ /
4
Run Code Online (Sandbox Code Playgroud)
这就是演示文稿的形式:
2 3 3
\ / /
5 1 => 5 1 => 5 1 => 5 => 5
\ / \ / \ / \
4 4 4 4
1. Remove vertex two and mark one.
2. Remove vertex three and mark one.
3. Remove vertex one and mark four.
4. Remove vertex four and mark five.
Run Code Online (Sandbox Code Playgroud)
因此,此图表的演示文稿将是:
1 1 4 5
Run Code Online (Sandbox Code Playgroud)
问题是,如何将此演示文稿转换为邻接矩阵或邻接列表?Fe与1 …
我在JSON中有这个需要解码的产品列表:
"[{"productId":"epIJp9","name":"Product A","amount":"5","identifier":"242"},{"productId":"a93fHL","name":"Product B","amount":"2","identifier":"985"}]"
Run Code Online (Sandbox Code Playgroud)
在我用PHP解码之后json_decode(),我不知道输出是什么类型的结构.我以为它会是一个数组,但在我要求count()它之后说它是"0".如何遍历此数据以便获取列表中每个产品的属性.
谢谢!