Next Greater Element III at DoorDash

Medium35.1% acceptance

This problem has 62.5% frequency at DoorDash.

Problem Description

Given a positive integer `n`, find _the smallest integer which has exactly the same digits existing in the integer_ `n` _and is greater in value than_ `n`. If no such positive integer exists, return `-1`. **Note** that the returned integer should fit in **32-bit integer** , if there is a valid answ...

Read full problem and hints

Topics

Also asked at 13 companies


More DoorDash Questions

View all DoorDash questions