I need a solution to this problem
Difference between en1 and en2, changed 2 character(s)
Can someone please tell me an approach and possibley the code for this problem.↵

Given an array A, you need to split the array into non empty subarrays such that each subarray is a permutation (each number from 1 to the n appears exactly once where n is the size of the subarray). For eg: A=2,1,3,6,3,1,2,5,4,2,1. Then the subarrays are {2,1,3},{6,3,1,2,5,4},{2,1}. You need to return these subarrays

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English NewCoder100 2025-10-13 14:49:11 144
en2 English NewCoder100 2025-10-13 11:45:27 2 Tiny change: 'nd possible the code ' -> 'nd possibly the code '
en1 English NewCoder100 2025-10-13 11:44:59 434 Initial revision (published)