Find the next smaller number with the same set of digits
Filed under Hike
The question
Given an integer, find the greatest smaller number that can be formed using the exact same digits. Return -1 if no such smaller number exists.
No write-up yet. Related questions below have one.
Related Hike questions
Collected from public candidate posts and coding forums. Updated Nov 2026.