Consecutive Numbers Sum

Given a positive integer A.

Return the number of ways it can be written as a sum of consecutive positive integers.


Input Format:

The first and the only argument of input contains an integer, A.

Output Format:

Return an integer, representing the answer as described in the problem statement.

Constraints:

1 <= A <= 1e9

Examples:

Input 1:
	A = 5

Output 1:
	2

Explanation 1:
	The 2 ways are:
	=> [5]
	=> [2, 3]
	
Input 2:
	A = 15

Output 2:
	4

Explanation 2:
	The 4 ways are:
	=> [15]
	=> [7, 8]
	=> [4, 5, 6]
	=> [1, 2, 3, 4, 5]
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Consecutive Numbers Sum on Interview Code Editor
Sign Up
to access hints and editorial solutions for Consecutive Numbers Sum

Discussion


Loading...
Click here to start solving coding interview questions