kyu_4.next_smaller_number_with_the_same_digits package

Submodules

kyu_4.next_smaller_number_with_the_same_digits.next_smaller module

kyu_4.next_smaller_number_with_the_same_digits.next_smaller.find_x(n: int) → int[source]
kyu_4.next_smaller_number_with_the_same_digits.next_smaller.find_y(n: int, x_i: int) → int[source]
kyu_4.next_smaller_number_with_the_same_digits.next_smaller.next_smaller(n: int) → int[source]

A function that takes a positive integer and returns the next smaller positive integer containing the same digits.

If no smaller number can be composed using those digits, return -1

kyu_4.next_smaller_number_with_the_same_digits.test_next_smaller module

class kyu_4.next_smaller_number_with_the_same_digits.test_next_smaller.NextSmallerTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_next_smaller()[source]

Testing next_smaller function

You have to test a function that takes a positive integer number and returns the next smaller number formed by the same digits:

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

If no smaller number can be composed using those digits, return -1

Module contents