Rearrange is a Python program that rearranges a list of integer by ordering it in ascending order using the number of ones in their binary equivalence. In case where to two integers have the same number of ones, they are order using the decimal placevalue.
import main
main.rearrange([5, 3, 7, 10, 14], 5) # returns [3, 5, 10, 7, 15]
main.rearrange([3, 2, 1], 3) # returns [1, 2, 3]
Project development has stopped completely
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.