diff --git a/day_23/part_1.php b/day_23/part_1.php new file mode 100644 index 0000000..ac83d3e --- /dev/null +++ b/day_23/part_1.php @@ -0,0 +1,60 @@ += count($cups)) { + $current_index = 0; + } +} + +// moves done, now count from 1 +$index_1 = array_search(1, $cups, true); +$final_labels = ''; +$current_index = $index_1 + 1; +for ($i = 1, $l = count($cups); $i < $l; $i++) { + if ($current_index >= $l) { + $current_index = 0; + } + $final_labels .= $cups[$current_index]; + $current_index++; +} + +echo $final_labels; +