โ† BlackRock questions

Next greater number with the same set of digits

Filed under BlackRock

Given a positive integer n, find the smallest integer that has exactly the same digits existing in n and is greater in value than n. If no such positive integer can be formed, return -1.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related BlackRock questions

Collected from public candidate posts and coding forums. Updated Nov 2026.