<?php function solve($input) { foreach($input as $index => $element) { if($index > 1 && $element < $input[$index - 1]) { return array_merge([array_slice($input, 0, $index)], solve(array_slice($input, $index))); } } return [$input]; }
You have javascript disabled. You will not be able to edit any code.