diff --git a/day_7/part_1.php b/day_7/part_1.php new file mode 100644 index 0000000..69ca85d --- /dev/null +++ b/day_7/part_1.php @@ -0,0 +1,41 @@ + $item) { + if (!in_array($bag, $shiny_list, true) && count(array_intersect($shiny_list, $item)) > 0) { + $at_least_one_add = true; + $shiny_list[] = $bag; + } + } + + if ($at_least_one_add) { + return has_shiny_in($total_list, $shiny_list); + } + + return $shiny_list; +} + +var_dump(has_shiny_in($possible_bags)); \ No newline at end of file