Ad
  • Custom User Avatar

    Because 1) one can only assume that the sequence have at least 3 items, any more is not guaranteed (while any less would make no sense) and 2) 3 items give me enough information to know if the sequence has more even or odd items.

    The rest of the explanation is above, let me know if you still miss some part of it and I will be glad to explain :)

  • Custom User Avatar

    So, why only the first three numbers? thats where I'm getting tripped up? why not every number? or is this just a limited solution?

  • Custom User Avatar

    My pleasure to help a fellow code-warrior; even more if you took the time to consider and look at my work :)

  • Default User Avatar

    Yeap that was perfect! thanks guys!;)

  • Custom User Avatar

    Perfectly explained by bkaes-senpai :)

    If I were to analyze it myself, I would say that I tried a more creative approach instead of some brute-force method, assuming of course that each sequence had to have at least 3 elements. The first line split and parses the string, turning everything into either 0 (if it is even) or 1 (if it is odd), then the final two see if we are looking for the sole odd or the sole even and act accordingly :)

    Let me know if I answered your question properly :)

  • Default User Avatar

    nice!, could you explain whats going on? Thanks :)!

  • Default User Avatar

    You could use your sum function to do your average one.