Generate the next lexicographic ordering | DoorDash Interview Question