Ad
  • Custom User Avatar

    No.

  • Custom User Avatar

    As it reads

    1. Select each number and it's index (0 based position) in the list
    2. If current number equal to previous number in List (ignoring index 0 because no previous number) add null entry to new returned enumerable
    3. Else [Implied If current number not equal to previous number - i.e. beginning of new sequence] Skip(i) amount of elements up to current position and Take() the next value in this sub-enumerable While() next value is equal to current value in the outer enumerable and Sum() them together
    4. Filter out nulls
    5. Select values
    6. Convert to List for return type

    {1,4,4,4,0,4,3,3,1} becomes:
    {1,12,null,null,0,4,6,null,1}

  • Custom User Avatar

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

  • Custom User Avatar

    I'm confused how this solution doesn't produce {1,12,8,4,0,4,6,3,1} for Input: {1,4,4,4,0,4,3,3,1} but I couldn't figure out any one liner so what do I know.

  • Custom User Avatar

    I beg to differ, as bad practice is to modify input in place if not required, not to just pass objects which are mutable.

  • Custom User Avatar

    Pretty anything immutable. Tuple is great.
    Its definitely not a problem for kata itself, rather developing bad practice for greenhorns. IMO, for sure.

  • Custom User Avatar

    That could be a suggestion, at best, but I would not call it an issue, otherwise you should flag A LOT of other katas.

    And, mh... it is quite debatable: what would you pass in a similar problem?

  • Custom User Avatar

    Passing list as argument to function is kind of antipattern for python in most cases

  • Custom User Avatar

    I would say they do, based on about 6000 people completing it successfully.

    Can you be a bit more specific?

    [I will also close the issue, assuming it is not about something not actually working in the tests]

  • Custom User Avatar

    I was getting this due to code running longer than the timeout

  • Custom User Avatar

    Test's don't really match expectations based on instructions.

  • Custom User Avatar

    Test Cases Incorrect for Submission - Console.WriteLine'd out on C# Test
    The instructions do not specify any race is a ZERO value, and Tests within the ShouldBeATie Section show that the zeros do not count towards score:
    Good: 1 0 0 0 0 0
    Evil: 1 0 0 0 0 0 0 (From ShouldBeATie)
    Cannot make all tests pass by accounting for 0 value or not!

    Time: 671ms Passed: 3 Failed: 3
    Test Results:
    GoodVsEvil
    EvilShouldWin
    Log
    Good: 1 1 1 1 1 1
    Evil: 1 1 1 1 1 1 1
    Good: 1 1 1 1 1 1 -- Is not EvilShouldWin (Is Infact a Draw)
    Evil: 0 1 1 1 1 1 1 -- Is not EvilShouldWin (Is Infact a Draw)
    ✔ 1 assertion passed
    ✘ Expected string length 48 but was 45. Strings differ at index 15.
    Expected: "Battle Result: Evil eradicates all trace of Good"
    But was: "Battle Result: No victor on this battle field"
    --------------------------^
    Completed in 0.026539ms
    GoodShouldTriumph
    Log
    Good: 0 0 0 0 0 10
    Evil: 0 1 1 1 1 0 0
    Good: 1 1 1 1 1 1
    Evil: 0 0 1 1 1 1 1
    Good: 0 1 0 0 0 0 -- Is not GoodShouldTriupmh (Is Infact a Draw)
    Evil: 1 0 0 0 0 0 0 -- Is not GoodShouldTriupmh (Is Infact a Draw)
    ✔ 2 assertions passed
    ✘ Expected string length 38 but was 45. Strings differ at index 15.
    Expected: "Battle Result: Good triumphs over Evil"
    But was: "Battle Result: No victor on this battle field"
    --------------------------^
    Completed in 0.00101ms
    ShouldBeATie
    Log
    Good: 1 0 0 0 0 0
    Evil: 1 0 0 0 0 0 0
    Good: 0 0 0 0 0 0
    Evil: 0 0 0 0 0 0 0
    Good: 1 1 1 1 1 1
    Evil: 1 0 1 1 1 1 1
    Good: 1 0 0 0 0 0
    Evil: 1 0 0 0 0 0 0
    Good: 0 1 0 0 0 0
    Evil: 0 1 0 0 0 0 0
    Good: 0 1 0 0 0 0
    Evil: 0 0 1 0 0 0 0
    Good: 0 1 0 0 0 0
    Evil: 0 0 0 1 0 0 0
    Good: 0 0 1 0 0 0
    Evil: 0 0 0 0 1 0 0
    Good: 0 0 0 1 0 0
    Evil: 0 0 0 0 1 0 0
    Good: 1 0 0 0 1 0 -- Not A Tie (Good Wins)
    Evil: 0 0 0 0 0 1 0 -- Not A Tie (Good Wins)
    ✔ 9 assertions passed
    ✘ Expected string length 45 but was 38. Strings differ at index 15.
    Expected: "Battle Result: No victor on this battle field"
    But was: "Battle Result: Good triumphs over Evil"
    --------------------------^
    Completed in 0.000577ms