我有一个动态长度 L1 的数组。我需要将此数组拆分为 L2 个数组,每个数组都有LEN[i]来自原始数组的数字。
EX:
Original:
$array=[1,2,3,4,5,6,7,8,9,10]
Here L1=10
L2=3
$LEN=[3,3,4]
So the 3 arrays will be
$a1=[1,2,3]
$a2=[4,5,6]
$a3=[7,8,9,10]
Run Code Online (Sandbox Code Playgroud)
我尝试了很多方法,但似乎没有任何效果。任何帮助将不胜感激。