Given two points in a Cartesian coordinate system, find the x-value, where polynomial of 1. order (y = m*x+c) is equal to a given value c.
e.g.: we have the points P1(1,2) and P2(3,6) and we want wo know at which x-value y is equal to c = 8; The input is: x = [1 3], y = [2,6], c = 8.
The answer is 4.
Consider the possibility that there isn't any solution (return NaN) of that there is an infinity amount of points (return Inf). Additionally consider that the point could represent a vertial line.
Good Luck!
I don't understand the meaning of the problem. If y=c then x=0. Enlighten me, please.
If y=mx+b, when y=c, x=?
Hi everyone:
Dan: in my mathematical understanding (correct me if I am wrong): if y=c the slope m of the curve is 0. but for all x the condition y = c is correct, so x should be infinite
Or is there some error in the solution?
Nice one. hard to figure this out.
I don't like my solution. I rader prefer David's. JEJE
nice solution :-)
123 Solvers
Project Euler: Problem 10, Sum of Primes
531 Solvers
Check if number exists in vector
2049 Solvers
98 Solvers
203 Solvers