Ad
  • Custom User Avatar

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

  • Custom User Avatar

    Oh, I see. That's right.

  • Custom User Avatar

    But the description says "Output: A list of strings representing "suspicious" apartments in the format room number based on the criteria outlined below, ordered by ascending room number."

  • Custom User Avatar

    At least two neighbouring apartments toggled lights four or more times during the night(4C and 4E), while the occupant(4D) of the apartment in question wasn't consistently in sight that night.

  • Custom User Avatar

    Bur for choosing 4D as suspicious, the two neighbours (in this case 4E and 4C) don't have to be suspicious. They just need to toggle lights at least 4 times. The occupant refers to 4D, not to 4E and 4C.

  • Custom User Avatar

    I am not sure I used 'visible' correctly there, because you are right, 'visible' means 'occupant present'.

    But 4D is suspicious in your example because:

    1. the occupant wasn't consistently visible through the window that night (because 4D initially has status 0, so no person present)
      and
    2. two neighbours toggled lights 4 or more times: 4C and 4E. Toggling works 0-1-0-1 as well as 2-3-2-3 or 0-3-2-1.
  • Custom User Avatar

    4E is not always visible. Iniitally is 3 (ligths on), then comes 2 (ligths off) -> 3 (lights on) - > 2 (ligths off) -> 3 (ligths on). So you get 4D because of 4C and 4E.

    The occupant of 4D should not always be visible. In your example: 4D is suspicious because 4E and 4C toggle ligths at least 4 times and the occupant of 4D is not visible at the starting point (initially 4D is 0, so lights off, no person).

  • Custom User Avatar

    @SpandexTiger, I just solved it and I also found it hard to understand for a couple of hours. But reading some of the first comments from this kata (between Blind4Basics and Johan) should help you understand how to calculate the oddness (without those comments I wouldn't have been able to complete it xD).

  • Custom User Avatar

    Approved as 6 kyu.

  • Custom User Avatar

    Approved as 5 kyu (average voted rank). :)

  • Custom User Avatar

    Yep, I think now it's definitely clear. Thanks. :)

  • Custom User Avatar

    The way I read it initially was that I should count the toggles in the neighbour apartment only if in that particular moment the occupant is not there.

    So like, checking if B2 is suspicious: (B1 0), (B1 1) -> I count these toggles. Now if (B2 3) comes, someone is there in B2, so if after that (B1 0) comes, I thought I should ignore this toggle, until B2 becomes 0 or 1, so until the person leaves. I thought this because of the "while the occupant wasn't consistently visible". I understood that this is not the case from the tests. It's much more, "if there is at least one moment in the entire night when the occupant leaves/is not seen". But it could be my bad english that didn't help to understand it better. :D
  • Custom User Avatar

    Nice kata! :D At first the last condition was a bit difficult to understand, but the examples helped a lot. Really a new and nice idea, it was fun. :)

  • Custom User Avatar

    Description should specify the formula used for golden ratio, or at least remove the 1.618 part, since one may think that that's the used value for this particular kata.

  • Custom User Avatar

    Am I missing something?

    0.9999709702062644 should be close to 0.9999789937973299 with absolute or relative margin of 1e-09

    0.6180290297937356 should be close to 0.6180210062026701 with absolute or relative margin of 1e-09

    1.1755432033417759 should be close to 1.175545810312674 with absolute or relative margin of 1e-09

    0.6180110885384781 should be close to 0.6180080239281595 with absolute or relative margin of 1e-09

  • Loading more items...