We make two recursive calls , so reduce k by 2.
k -= 2 ; int mid = ( l + r ) / 2 ; swap ( a [ mid - 1 ] , a [ mid ] ) ; unsort ( l , mid , a , k ) ; unsort ( mid , r , a , k ) ; } void arrayWithKCalls ( int n , int k ) { if ( k % 2 == 0 ) { cout << " ▁ NO ▁ SOLUTION ▁ " ; return ; }