Learn practical skills, build real-world projects, and advance your career
Updated 3 years ago
Next Permutation
To learn how to use this template, check out the course "Data Structures and Algorithms in Python".
project_name = 'lexicographical permutation arrangement'
from jovian.pythondsa import evaluate_test_cases
Problem Statement
Rearraging a list of numbers into Lexicographically next greater permutation of list of numbers. If such arrangement is already last possible permutation then it must be rearranged to the lowest possible order i.e. sorted in an ascending order.
Solution
1. State the problem clearly. Identify the input & output formats.
While this problem is stated clearly enough, it's always useful to try and express in your own words, in a way that makes it most clear for you.
Problem
the function Permutation() which takes input parameter and returns a list of numbers containing the next permutation.
Input
- A list of integers
Output
- A list of integers
Based on the above, we can now create a signature of our function: