Ad
  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    when the lenght of array1 equal 0 function will return array2
    and the lenght of array2 equal 0 function will return array1

  • Custom User Avatar

    You're reading the logs wrong, the log appears above the test result. And the parity of the decimal representation of the number doesn't matter, this is about the number of 1s in the string. Just add the number (1 or 0) at the end. If you check the Wikipedia link in the kata description, it is explained.

  • Custom User Avatar

    It doesn't matter, you want the number of 1s to be either odd or even.

  • Custom User Avatar

    You just need to click on Attempt rather that the CTRL+S shortcut. There are tests on the back-end. I was also initially confused about this, but figured it out after console logging 'hello' and running an Attempt. Hope it helps!

  • Custom User Avatar

    For the given example

    (45 11 100) is the input. This means 45 carbon, 11 hydrogen and 100 oxygen.

    Then you need to determine how many H2O, CO2 and CH4 will be made. The order is determine H2O first, then CO2, then CH4

    So, for (45 11 100) you first make H2O.

    You can make 5 H2O (as this requires 10 hydrogen and 5 Oxygen)
    This leaves you with (1 Hydrogen, 95 Oxygen, 45 carbon)

    Now make CO2
    You can make 45 CO2 (as this requires 45 Carbon and 90 Oxygen)
    This leaves you with (1 Hydrogen, 5 Oxygen and 0 Carbon)

    Now make CH4, you can't make any CH4 as you have no carbon and only 1 hydrogen.

    So the result is (5, 45, 0)

    Does this help?