function to generate all possible answers . and compute minimum of all costs . i -- > is index of previous partition par -- > is current number of partitions a [ ] and n -- > Input array and its size current_ans -- > Cost of partitions made so far .
void solve ( int i , int par , int a [ ] , int n , int k , int current_ans ) {