Two circles on a Cartesian plane, A and B, are each defined by three descriptors:
Circles A and B will both be centered either on the X-axis (i.e., YA = 0 and YB = 0, or on the Y-axis (i.e., XA = 0 and XB = 0), but not both.
A pair of circles (A and B) will have one of the following relationship types:
Complete the function circles in the editor.
circles has the following parameter(s):
string circlePairs[n]: each string contains six space-separated integers. The first three integers are X, Y, and R for circle A, and the last three are X, Y, and R for circle B.
Returns
string[n]: each string is the relation between the circles described in circlePairs[i]
Examples
01 · Example 1
circlePairs = ["3 0 10 5 0 3", "0 1 4 0 1 5"] return = ["Disjoint-Inside", "Concentric"]
1. The circles are Disjoint-Inside.
Circle A is centered at (3, 0) and extends 10 units along the x-axis from -7 to 13.
Circle B is centered at (5, 0) and extends 3 units along the x-axis from 2 to 8.
2. The circles are Concentric.
Circle A is centered at (0, 1) and extends 4 units along the y-axis from -3 to 5.
Circle B is centered at (0, 1) and extends 5 units along the y-axis from -4 to 6.
Constraints
- 1 ≤ n ≤ 5000
- 0 ≤ X,Y,R ≤ 5000
More IBM problems
- Count Ideal NumbersOA · Seen Jun 2026
- Count Descending SubarraysOA · Seen Apr 2026
- Count Power Products in RangeOA · Seen Apr 2026
- Minimum Operations to Make Alternating Binary StringSeen Feb 2026
- Minimum Number of Non-Empty Disjoint SegmentsSeen Feb 2026
- Count Unstable ProcessesOA · Seen Feb 2026
- Longest Balanced Binary SubarrayOA · Seen Feb 2026
- Process Execution TimeOA · Seen Nov 2025
public String[] circles(String[] circlePairs) {
// write your code here
}
circlePairs["3 0 10 5 0 3", "0 1 4 0 1 5"]
expected["Disjoint-Inside", "Concentric"]
sign in to submit