X

DAYS

:

HOUR

:

MINS

:

SEC

Copied to Clipboard
Line passing through 2 points
Basic Accuracy: 35.19% Submissions: 441 Points: 1

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 ≤ 105

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.

Line passing through 2 points

Output Window