Number of Integer solutions
Basic Accuracy: 75.78% Submissions: 808 Points: 1

You are given a positive integer N and you have to find the number of non negative integral solutions to a+b+c=N.

 

Example 1:

Input:
N = 10
Output:
66
Explanation:
There are 66 possible solutions.

Example 2:

Input:
N = 20
Output:
231
Explanation:
There are 231 possible solutions.

 

Your Task:
You don't need to read input or print anything. Your task is to complete the function noOfIntSols() which takes an Integer N as input and returns the number of integer solutions possible.

 

Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)

 

Constraints:
1 <= N <= 109

We are replacing the old Disqus forum with the new Discussions section given below.
Click here to view old Disqus comments.


to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Number of Integer solutions

Output Window