2021年1月8日

PHP 求多个数组的笛卡尔积,适用于求商品规格组合 【深度优先搜索】【原创】

摘要: $arr = [ ['黑','白','红','绿'], ['大','小'], ['A','B','C','D']];$book = [[0,0,0,0], [0,0], [0,0,0,0]];$res = [];$pos = 0;function dfs($arr,$step,&$res,$book 阅读全文

posted @ 2021-01-08 14:50 刷哥 阅读(201) 评论(0) 推荐(0) 编辑

PHP 求多个数组的笛卡尔积,适用于求商品规格组合【原创】

摘要: $a = ['黑','白','红','绿'];$b = ['大','小'];$c = ['A','B','C','D'];$count_a = count($a);$count_b = count($b);$count_c = count($c);$total = $count_a * $count 阅读全文

posted @ 2021-01-08 14:46 刷哥 阅读(373) 评论(0) 推荐(0) 编辑

导航