Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more
  • Those examples are much clearer, thanks! I was about to say if it's so hard to explain, then maybe lose the requirement :-) But then that would make it somewhat easier to solve.

  • what the hell did I do... x/

    Wait a sec

  • Where does that 27 come from ?!?

  • oh damn... let's make the "alignments" clearer (maybe...):

        (put some good worded specs here x) )
            For [99,11,4,7,1,200,9]:
              possible triplets:          [11,7,9] and [4,7,1]
              indexes:                    (1, 3,6)     (2,3,4)  
              returns the sorted triplet: [7,9,11], because lexicographically (1,3,6) < (2,3,4)
            For [17,20,21,9,13]:
              possible triplets:          [17,9,13] and [17,21,13]
              indexes:                    ( 0,3, 4)     ( 0, 2, 4)
              returns the sorted triplet: [13,17,21], because lexicographically (0,3,4) > (0,2,4)


  • Your code should find the first valid Arithmetic Sequence that can be constructed from any 3 integers in the group

    This is confusing, because that would imply sorting by the lowest highest index first. ( That's the first sequence you find completely. )

    "Your code should find the sequence whose indices are lexicographically lowest" ?

    It's jargony, but correct ( I think ), and the examples can clarify ( which is what they are for ).

  • [13,20,27] from [17,20,13,9,27] would give (1,2,4), not (0,2,3) ?

  • woops, that's because I changed the arrays allong the way. The </> thing is coming from python. Might not be general enough, yes. Any help about the first §? (because the spec is there, actually x) )

    edit: wait... How that it's not (0,2,3)???

  • except it isn't (0,2,3). and mixing < and > is confusing.

    Personally, I would rather focus on a correct spec than on improved examples.

  • mmmmh... I didn't even read that part... x) (formatting is somewhat horrible. Nobody will reach that part of the description, I guess, if you don't make it clear there is something important to grasp here).

    Sooo, that would be somehting like

        Return the first triplet (sorted by values) satisfying the conditions.
        If there are several possbilities choose the triplet so that its indexes
        in the original array would be minimal (like for a key function comparison):
            [99,11,4,7,1,200,9] returns [7,9,11] because:
              [11,7,9] is a possible triplet, but [4,7,1] too
              indexes: (1,3,6) < (2,3,4) because of the 1
              returns [7,9,11] (sorted)
            [17,20,13,9,27] returns [13,20,27] because:
              [17,13,9] is a possible triplet, but [17,20,13] too
              indexes: (0,2,3) > (0,1,2) because of the 1
              returns [13,20,27] (sorted)

    edit: I don't like that part: (like for a key function comparison). But didn't find something better...

  • Except in an ice hockey team then?

    It might help someone see that the first index need not be 0. I wasn't worried about that, but someone else might be. See the problem with examples?

  • 99 is Wayne Gretzky's retired number. It's ALWAYS appropriate to include :)

    But really, I added it just to give a case where the first index isn't 0. Good feedback that it muddies more than helps though.

  • But you're right, I should've said it when I saw something was failing on a sample test, but passing random tests. I just went on hastily to another kata =/

  • Thanks much for all the help. Went with most of what you changed and cleaned up more.

  • Loading more items...