Based on Arithmetic sum of first n consecutive numbers formula. Easy 1ms O(n) Java solution.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.