This is a verified interview question from Schlumbergera. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Distance of Two Points from Origin - Schlumbergera Online Assessment IIT BHU" covers key patterns like Arrays.
"Given two points `(x1, y1)` and `(x2, y2)`, calculate the distance of each point from the **origin `(0, 0)`**. Round each distance to the **nearest integer** and return the rounded distances. The distance of a point `(x, y)` from the origin is: ```text distance = √(x² + y²) ``` ### Example ```text Input: P1 = (3, 4) P2 = (6, 8) ``` Distance of `P1`: ```text √(3² + 4²) = √25 = 5 ``` Distance of `P2`: ```text √(6² + 8²) = √100 = 10 ``` ```text Output: 5 10 ``` ### Example 2 ```text Input: P1 = (2, 3) P2 = (5, 7) ``` ```text P1 distance = √13 ≈ 3.606 → 4 P2 distance = √74 ≈ 8.602 → 9 ``` ```text Output: 4 9 ``` ### Constraints ```text -10^9 ≤ x1, y1, x2, y2 ≤ 10^9 ``` ---"
Join thousands of developers practicing for Schlumbergera.