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 |

Given 4 integers a,b,c and k . Find the min(non-negative Integral) value of x such that ax^{2}+bx+c >= k.

**Example 1:**

**Input: **a = 4, b = 6, c = 5, k = 5
**Output:** 0
**Explanation**: 4*(0)^{2}+6*0+5 = 5 which is
>= 5.

â€‹**Example 2:**

**Input: **a = 1, b = 2, c = 3, k = 4
**Output:** 1
**Explanation**: 1*(1)^{2}+2*1+3 = 6 which is
â€‹>= 4.

**Your Task: **

You don't need to read input or print anything. Your task is to complete the function **minX()** which takes **a, b, c **and **k **as inputs and returns the answer.

**Expected Time Complexity:** O(log k)

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

**Constraints:**

1 ≤ a, b, c ≤ 10^{5}

1 ≤ k ≤ 10^{9}

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
Min value of x

...