Geeksforgeeks

Error

×

Leaderboard

Showing:

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

@Ibrahim Nash | 5761 |

@blackshadows | 5715 |

@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 | 1115 |

@bt8816103042 | 739 |

@thealchemist627 | 456 |

@akashkale117 | 453 |

@shivanandp12345678910 | 453 |

@dalwainazism125 | 453 |

@codeantik | 448 |

@SherlockHolmes3 | 447 |

@SHOAIBVIJAPURE | 430 |

@shalinibhataniya1097 | 408 |

@neverevergiveup | 393 |

Complete Leaderboard |

Given 5 integers K, L, R, X, Y. Find whether there exists two integers A and B such that A / B = K where L ≤ A ≤ R and X ≤ B ≤ Y.

**Example 1:**

**Input:** K = 1, L = 1, R = 10
X = 1, Y = 10
**Output:** 1
**Explanation:**
A = 1 , B = 1 exists such that L ≤ A ≤ R,
X ≤ B ≤ Y and A / B = K.
Note,there are other pairs present
Like A = 2, B = 2 etc which also satisfy
the conditions.

**Example 2:**

**Input:** K = 1, L = 1, R = 5
X = 6, Y = 10
**Output:** 0
**Explanation:**
No such A and B exist that satisfy all
the conditions.

**Yout Task:**

You don't need to read input or print anything.Your Task is to complete the function **easyProblem() **which takes 5 integers K, L, R, X and Y as input parameters and returns 1 if there exists two numbers that follow above given conditions. Otherwise return 0.

**Expected Time Complexity:**O(N)

**Expected Auxillary Space:**O(1)

**Constraints:**

1≤ K, L, R, X, Y≤ 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
An Easy problem

...