I need a solution to this problem

Правка en2, от NewCoder100, 2025-10-13 11:45:27

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

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский NewCoder100 2025-10-13 14:49:11 144
en2 Английский NewCoder100 2025-10-13 11:45:27 2 Tiny change: 'nd possible the code ' -> 'nd possibly the code '
en1 Английский NewCoder100 2025-10-13 11:44:59 434 Initial revision (published)