I am being asked to calculate the sum of digits , which will be obtained into an array. The problem is that I need to save both time and space.
My plan was to add each digit to the sum and verify if it's larger than 10. If it is, then I substract 10 out of it. But this also requires too much time... more than even recursivity. Ialso don't want to create other arrays...
Any ideas?