Preparing for Coding Interviews ?? and not able to find relevant questions 😩

Hey ! we Got You Covered 😁

Browse through our Top Interview questions

Crack your Interviews like a pro 😎

## Next Permutation From Pool - Facebook Top Interview Questions

You are given two strings digits and lower both representing decimal numbers. Given that you can rearrange digits in any order, return the smallest number that's larger than lower. You can assume there is a solution. Constraints 1 ≤ n ≤ 100,000 where n is the length of digits 1 ≤ m ≤ 100,000 where m is the length of lower Example 1 Input digits = "852" lower = "100" Output "258" Example 2 Input digits = "090" lower = "0" Output "9" Explanation

View Solution →