Can someone please tell me an approach and possible 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




