Ruby Coding Interview Question: Build a Dynamic Sum Method
This coding exercise walks through how to build a method that takes a single integer as an argument and builds a sum of all of the integers counting up to the argument value.
Build a program that sums all of the integers up to, and including any value passed in as an argument.
The program should be able to take in a single argument of an integer, and output the sum of all of the integers up to the argument’s value.
Real World Usage
This is a common Ruby coding interview question. Additionally, being able to create dynamic ranges and perform calculations on the collection is important in a number of applications.
Can be found on the solutions branch on github.