Leaderboard
Showing:
Ishaan's Sum Problem
Basic Accuracy: 35.91% Submissions: 39 Points: 1

Ishaan is curious about numbers. He takes any 2 random numbers A and B. He wants to find out that whether A can be written as a sum of B distinct positive integers.Help him find out whether it is possible or not.

Example 1:

Input: A = 5, B = 2
Output: 1 
Explanation: 5 can be written as a 
sum of 2 numbers : 1+4 or 2+3.


Example 2:

Input: A = 6, B = 2
Output: 1
Explanation: 6 can be written as a 
sum of 2 numbers : 1+5 or 2+4.


Your Task:  
You dont need to read input or print anything. Complete the function kthDistinct() which takes n as input parameter and returns 1 if it is possible
else return 0.

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

Constraints:
1<= A, B <=106

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.

Ishaan's Sum Problem

Output Window