Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 5761 |

@blackshadows | 5701 |

@akhayrutdinov | 5111 |

@mb1973 | 4989 |

@Quandray | 4944 |

@saiujwal13083 | 4506 |

@sanjay05 | 3762 |

@marius_valentin_dragoi | 3516 |

@sushant_a | 3459 |

@verma_ji | 3341 |

@KshamaGupta | 3318 |

Complete Leaderboard | |

Handle | Score |

@aroranayan999 | 938 |

@bt8816103042 | 739 |

@SHOAIBVIJAPURE | 428 |

@codeantik | 412 |

@SherlockHolmes3 | 407 |

@neverevergiveup | 348 |

@mahlawatep | 347 |

@shalinibhataniya1097 | 343 |

@murarry3625 | 333 |

@saiujwal13083 | 326 |

@rohitanand | 314 |

Complete Leaderboard |

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 = 2Output:1Explanation: 5 can be written as a sum of 2 numbers : 1+4 or 2+3.

**Example 2:**

Input:A = 6, B = 2Output:1Explanation: 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 <=10^{6}

Login to report an issue on this page.

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

Yes
Ishaan's Sum Problem

...