Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 829. Consecutive Numbers Sum
Count how many ways a given n (1 ≤ n ≤ 10^9) can be written as a sum of consecutive positive integers. The core challenge is finding lengths k and starting values a satisfying n = k*(2a+k-1)/2 — which reduces to a number-theoretic/divisor-counting check (equivalently counting appropriate divisors of n) that can be done in O(sqrt(n)).
Asked at:
Meta
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Mid October, 2025
Meta
Senior
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.