Dsa
Math
Hard
Consecutive Sums
Given an integer K, find how many distinct ways the number K can be expressed as a sum of consecutive positive integers. Output the number of distinct ways. The input consists of a single integer K (1 <= K <= 10^7).
Example Input:
9
Example Output:
3
Key concepts
mathseriescombinatorics
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now