This kata is from coderwars.
You have to create a function that takes a positive integer number and returns the next bigger number formed by the same digits:
nextBigger(12)==21
nextBigger(513)==531
nextBigger(2017)==2071
If no bigger number can be composed using those digits, return -1:
nextBigger(9)==-1
nextBigger(111)==-1
nextBigger(531)==-1
First let's see how to compare 2 numbers.