For finding the sum of n numbers, which is the better option for less time complexity?
- using a for loop and iterate throughout the n numbers of an array
- using the real equation (n*(n-1))/2
I think that the second one is correct, but it will also depends on the length of the array? Which one is correct here ?