Categorygithub.com/kotopheiop/gocodewarssolutionskyu_4Next_bigger_number_with_the_same_digits
package
0.0.0-20241102054555-b6e87e53946e
Repository: https://github.com/kotopheiop/gocodewarssolutions.git
Documentation: pkg.go.dev

# README

Next bigger number with the same digits

Create a function that takes a positive integer and returns the next bigger number that can be formed by rearranging its digits. For example:

  12 ==> 21
 513 ==> 531
2017 ==> 2071

If the digits can't be rearranged to form a bigger number, return -1 (or nil in Swift, None in Rust):

  9 ==> -1
111 ==> -1
531 ==> -1