I submitted the solution on hackerrank and got Accepted. There is a change
though, there may be more terms like Term (r+1)
but this can also be done using O(1).

Term (r+2) : (2*n+1 - (r+2)*k)/2 and so forth until numerator becomes zero.
You can use the same technique to get this sum as well.

Sorry for the inconvenience.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.

Reply via email to