上回邀請朋友一起來進行 pair programming,隨機挑了一個 Codewars 的題目來練習:Mumbling。
題目描述:
上回邀請朋友一起來進行 pair programming,隨機挑了一個 Codewars 的題目來練習:Mumbling。
題目描述:
Codewars 上的 kata: Next bigger number with the same digits
You have to create a function that takes a positive integer number and returns the next bigger number formed by the same digits:
f(12) == 21
f(513) == 531
f(2017) == 2071If no bigger number can be composed using those digits, return -1:
f(9) == -1
f(111) == -1
f(531) == -1