For a problem. Very tricky!There are 12 operations:
a. Addition of 1 from the left (Example: 000 -> 1000) b. Addition of 0 from the left (Example: 111 -> 0111) c. Addition of 1 from the right(Example: 000 -> 0001) d. Addition of 0 from the right (Example: 111 -> 1110) e. Shift by 1 from the left(Example: 000 -> 100) f. Shift by 0 from the left(Example: 111 -> 011) g. Shift by 1 from the right(Example: 000 -> 001) h. Shift by 0 from the right (Example: 111 -> 110) i. Reverse (Example: 0011 -> 1100) j. Start bit change(Example: 000 -> 100) k. End bit change(Example: 000 -> 001) l. All bit change(Example: 000 -> 111)
Following these operations 011 can be converted to 1010 by operation a -> i
011
- 1011 //Applying a
- 1010 //k
Following these operations 000 can be converted to 1110 by operation a -> e -> e
000
- 1000 //a
- 1100 //e
- 1110 //e
How to make a common operation function that will convert 011 to 1010 and 000 to 1110