Your Submissions
You haven't submitted any code for this challenge yet. Solve the problem by passing all the test cases, and your submissions will appear here.
xxxxxxxxxx
54
var ob1;
class LinearApproach{
nextPermutation(nums) {
// write your code here
return nums;
}
}
function tests() {
ob1 = new LinearApproach();
var assert = require('assert').strict;
let pass = 0;
try {
assert.deepStrictEqual(ob1.nextPermutation([1,2,3]), [1,3,2]);
console.log( 'Test1 - PASSED ');
pass += 1;
} catch (err) {
console.log(err);
}
try {
assert.deepStrictEqual(ob1.nextPermutation([1, 2, 5, 4, 3]), [ 1, 3, 2, 4, 5 ]);
console.log( 'Test2 - PASSED' );
pass += 1;
} catch (err) {
OUTPUT
Results will appear here.