Ad
  • Default User Avatar

    The main idea here is to implement an efficient algorithm and that is to use the formula above. If the kata author really wanted to teach you the use of loops, the author would have passed in a list of numbers.

    In my line of work I see way too many bindly implemented algorithms where the implementer does not worry about performance of the algorithm. I honestly think that performance of algorithms need to be taught (again), especially with big data (read: small improvements have big effects) and cloud computing (you pay per CPU time used)

  • Default User Avatar

    I think it was in math class at middle school. I think the main idea here is to check if you can find a formula before blindly implementing an algorithm. In this case google "sum of sequence of numbers" and here is the story we were told in class https://letstalkscience.ca/educational-resources/backgrounders/gauss-summation.

  • Default User Avatar

    On my second Kata here writing while loops, and Ninjas are writing arm architecture. Very nice, inspiring.