• Jeff Moden (8/27/2014)


    Eirikur Eiriksson (8/27/2014)


    keshabsingh (8/27/2014)


    This is not homework session. Your approach is very limited with hard coding the values. What if data is like this?

    Then, that in itself is a change to the initial requirements, which mind you are more limited than my hard coded values.;-) The sum of the values indicate a certain sequence could be another hint there who knows?

    It all boils down to the basics, if you are looking for a proper answer, ask a proper question!

    😎

    I thought the OP asked a pretty good question not to mention posting readily consumable data and the expected result. It's our "job" to remember that it's just test data and will vary in real life... just like we sometimes explain to other OPs. 🙂

    Yes, and he even gave a hint to what needed to be done, so where was his attempt at solving the problem? Nonexistent. Sure looked like home work so I asked for his code. Then everyone jumped in and gave possible solutions.