Linear time solution for sumArray toy problem

This is my linear-time solution for the sumArray toy problem. I have added some comments along the code and I hope they would be helpful for understanding the algorithm and logic behind the steps. Enjoy!