Question DSA-ARR-0076
HardHow does the 'next permutation' algorithm work?
- A.
Reverse the array
- B.
Find the rightmost i with a[i] < a[i+1], swap a[i] with the smallest larger element to its right, then reverse the suffix
- C.
Sign up free to see the answer and a step-by-step explanation.