CODING

Day 12: The “Next Permutation” Problem

Anjana Sudhir
The Code Shelf

--

Problem:

Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.

If such an arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order).

--

--

Anjana Sudhir
The Code Shelf

Senior Software Engineer & Scrum Master @ Agoda (Booking Holdings Inc.)