Skip to content

darkbaby123/kata-next-bigger-number

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kata: Next bigger number with the same digits

Summary

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

Thought & Solution

First let's see how to compare 2 numbers.

Coderwars answer

About

Next bigger number with the same digits

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published