Thanks for explanation. I never wrote code for bit operation, so its still difficult for me. I think I will practice some more bitwise operation coding and then come back to this.
In this kata, for negation I tried -x -1 where x is "0b000" it does not work for all diffrent bits and length is also not same in all the cases.
Thanks for explanation. I never wrote code for bit operation, so its still difficult for me. I think I will practice some more bitwise operation coding and then come back to this.
In this kata, for negation I tried -x -1 where x is "0b000" it does not work for all diffrent bits and length is also not same in all the cases.
Hi, see my message above, plz.
Can you please explain how n ^= (1<<b-a+1)-1<<s-b gives ~n. Any webside or book refrence is fine.
No, use
print(n, k)
in the editor. (assuming it's python)What do you mean? Should I type my solution here?
Print the input?
Looking for more tips. I solved by computing list, it works fine for test but not in attempt, due to lack of algorithem.