dynamic_programming.minimum_squares_to_represent_a_number

Functions

minimum_squares_to_represent_a_number(→ int)

Count the number of minimum squares to represent a number

Module Contents

dynamic_programming.minimum_squares_to_represent_a_number.minimum_squares_to_represent_a_number(number: int) int

Count the number of minimum squares to represent a number >>> minimum_squares_to_represent_a_number(25) 1 >>> minimum_squares_to_represent_a_number(37) 2 >>> minimum_squares_to_represent_a_number(21) 3 >>> minimum_squares_to_represent_a_number(58) 2 >>> minimum_squares_to_represent_a_number(-1) Traceback (most recent call last):

ValueError: the value of input must not be a negative number >>> minimum_squares_to_represent_a_number(0) 1 >>> minimum_squares_to_represent_a_number(12.34) Traceback (most recent call last):

ValueError: the value of input must be a natural number