In 7 bits, given a number store the number's content as long as the number is one of the following: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
First of all, is this possible?
I am not looking for code but for a design advice, eg store 1 in the 1st bit in this case, 0 in this case etc.
edit: This is used in a compression algorithm. In case the above is not possible, try to fit the number given we have on our hands the prev number and the prev number is 1, 2, 3, ... 10