Geeksforgeeks

Error

×

Leaderboard

Showing:

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

@Ibrahim Nash | 6420 |

@blackshadows | 6380 |

@mb1973 | 5642 |

@Quandray | 5233 |

@akhayrutdinov | 5111 |

@saiujwal13083 | 4610 |

@sanjay05 | 3762 |

@kirtidee18 | 3673 |

@marius_valentin_dragoi | 3522 |

@sushant_a | 3459 |

@verma_ji | 3413 |

Complete Leaderboard | |

Handle | Score |

@sanskar94511 | 603 |

@akashverma4 | 363 |

@swastik8750 | 300 |

@nishunishuraj18 | 286 |

@surajmamgai | 264 |

@anks9013 | 222 |

@nayan2709 | 213 |

@burhanuddinbohra72 | 212 |

@realname | 203 |

@amank8975 | 203 |

@Rajpra786 | 203 |

Complete Leaderboard |

Given two points **P(a, b)** and **Q(c, d)** in the coordinate plane, find the equation of the line passing through both the points.

**Example 1:**

**Input:** P = (3, 2)
Q = (2, 6)
**Output:** 4x+1y=14
**Explaination:** Using the formula to get
line equation from two points we can
get it.

**Example 2:**

**Input:** P = (3, 2)
Q = (5, 7)
**Output:** 5x-2y=11
**Explaination:** If we use the formula to
get line equation from two points we
get this equation.

**Your Task:**

You do not need to read input or print anything. Your task is to complete the function **getLine()** which takes the values a, b, c and d as input parameters and returns a string which represents the equation.

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

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

**Constraints:**

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

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
Line passing through 2 points

...