FunctionRacerProblemsRace

Check Straight Line

EasyMathPython, JavaScript, TypeScript, Java, C++

Return True if all the points in coordinates lie on one straight line (a line of any direction, including vertical), otherwise False. One or two points always lie on a line.

Example 1

coordinates [[1,2],[2,3],[3,4],[4,5]]
returns true

All on y = x + 1.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Math problems