idx to 0 to track the current position in nums.groups.
a. For the current group, iterate over nums starting from idx.
b. Check if the current subarray of nums matches the group.
c. If it matches, update idx to the end of the matched subarray.
d. If it does not match, move to the next position in nums and repeat step 2b.true.false.