X

DAYS

:

HOUR

:

MINS

:

SEC

Copied to Clipboard
Distance between 2 points
School Accuracy: 58.81% Submissions: 2471 Points: 0

Given coordinates of 2 points on a cartesian plane, find the distance between them rounded up to nearest integer.

Example 1:

Input: 0 0 2 -2
Output: 3
Explanation: Distance between (0, 0)
and (2, -2) is 3.


Example 2:

Input: -20 23 -15 68
Output: 45
Explanation: Distance between (-20, 23)
and (-15, 68) is 45.


You don't need to read or print anything. Your task is to complete the function distance() which takes x1, y1, x2 and y2 as input parameter and returns the distance between the given two points.

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

Constraints:
-1000 <= x1, y1, x2, y2 <= 1000