Ad
  • Custom User Avatar

    First destructure the string.
    Note that sometimes the string can be 2 characters and some times 3 characters.
    Then create an object with symbols as keys and names as values

    Then get the property of the created object with [c || d] .

    What this says is if 'c' is availale use that to get the required property ( in case the string has 3 characters )

    if 'c' is 'undefined' ( when the string is only 2 characters) use 'd' to get the property.

  • Custom User Avatar

    The "order" of elements in an unordered_set is implementation dependant right?
    I ran the same code in gcc and visual c++ compilers and visual c++ gave me the answers in reverse order.

  • Custom User Avatar

    Because problem needs answer to be rounded to the next integer. This trick works like calling ::ceil.
    If the extra have a decimal point value greater than or equal to 0.001 this addition will push the extra to next integer and explicit conversion to long long will get rid of remaining decimal points.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution