Ad
  • Default User Avatar

    Not an exact duplicate, but very close to this: Two's Complement

  • Custom User Avatar

    Hi,

    The description is still incorrect:

    Show that this process terminates.

    That's not at all what is asked for. The expected answer is find the minimum amount of flips needed to terminate the porcess.

  • Custom User Avatar

    Ruby 3.0 should be enabled, see this to learn how to do it

  • Default User Avatar

    How is the number of digits determined? If 45[10] = 101101[2] has 6 digits, then 0[10] = 0[2] has digits, following the same logic (all numbers from 0 to 0 can be represented with 0 bits). If 0 has 1 digit, then why should 45 be 101101 and not 0101101 for example?

  • Custom User Avatar

    Nice idea, but testing is ATM quite insuffucient indeed.

    I haven't thought it through, but are there edge cases where negative numbers come into play? If so, you want those as fixed tests. Or you want to specify a more restricted input domain.

    (Bitwise operators operate on 32-bit integers but JS internally represents up to 53-bit integers.)

    But first, really, random tests! :]