Ad
  • Custom User Avatar

    where do you see digits ?

  • Custom User Avatar

    The statement was confusing at first for me.
    I suggest:

    Transform the input array of 0s and 1s into an array that contains the lengths of each sequence of consecutive 1s.
    If there are no 1s, return an empty array.

  • Custom User Avatar

    The description should be language agnostic.
    In Python, objects are different from dictionaries.
    (Even though in JS, objects are basically dictionaries in disguise. ;-D)

  • Custom User Avatar

    I totally agree with the "longest streak" part.
    I mean, why single this one out? Just keep the same format as before:
    Each streak is worth

    As for the sorting, sort() and sorted() are both STABLE in Python, meaning that if you don't provide any other keys, it would automatically keep the original order in case of a tie.
    That's why both yield the same result.

  • Custom User Avatar

    I'm sorry I don't understand what you are both saying, about nearing to the "nearest even integer" (it's probably because of my lack of mathematical knowledge).

    In Python, as far as I know, if you try to round let's say 4.6, it will give you 5, which is the "nearest integer" (not even), just like it's specified in the statement.

    What am I missing?

  • Custom User Avatar

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

  • Custom User Avatar

    In the description, you wrote:

    • The reinforces strings consist of only small letters.

    Although, as we can see in the examples, it can also include digits.

    Also, "reinforces" is a verb only. The correct noun is "reinforcements".

  • Custom User Avatar

    Returning 0, as per stated in the description, involves 2 conditions:

    • being a valid sequence (numerical values only)
    • having NO missing numbers

    As I said before, an empty sequence is either considered:

    • valid AND missing some numbers (starting with 1) -> so it should return the missing number
      OR
    • not valid (having no numerical values at all) -> so it should return 1

    An empty sequence doesn't satisfy both conditions for returning 0.
    And 1 is the missing number because as stated in the descritpion:
    "Check if the elements are part of an ascending sequence of integers starting with 1".

  • Custom User Avatar

    an empty sequence is valid but missing 1
    In both cases, the return value should be 1, not 0.

    If the sequence is valid, the return value should be 0, not some missing value:

    "1 2 3 4" -> 0  (not 5)
    "1"       -> 0  (not 2)
    ""        -> 0  (not 1)
    
  • Custom User Avatar

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

  • Custom User Avatar

    The description states:

    if the bit is 1, swap the case; if its 0, leave it as is.

    And:

    When you finish with the last bit of n, start again with the first bit.

    What is inconsistent here?

  • Custom User Avatar

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

  • Custom User Avatar
  • Custom User Avatar

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

  • Custom User Avatar

    I agree about the bullet points layout.

    In the example you gave though, "a white space" is one thing, "number of error for that letter in a field of 6" is another thing.

    Maybe this would be clearer: "the number of errors as a left justified string of 6 characters long".

    The white space is usually the default filling character in an aligned string (center, left or right).

  • Loading more items...