As reported: D. E. Shaw SMTS screening on HackerRank (Oct 2025), question 2 of 2: given the radii of some circles and a required number of equal segments, find the maximum area of equal segments that can be cut from the circles, returned as a string rounded to four decimal places.
You are given the radii of n circles and an integer segments. Cut segments pieces of equal area from the circles; each piece must come from a single circle (pieces cannot be glued together from leftovers of several circles), and some circles may stay unused. Return the maximum possible area of one piece, as a string rounded to 4 decimal places.
The area of a circle of radius r is π · r · r with π = 3.14159265359.
Example 1
radius = [1,1,1,2,2,3], segments = 6
Output: "7.0686"
Each radius-2 circle gives 1 piece of area 7.0686 and the radius-3 circle gives 4; the radius-1 circles are too small.
Example 2
radius = [4,3,3], segments = 3
Output: "28.2743"
Each radius-3 circle gives one piece; the radius-4 circle gives one more.
Constraints: 1 ≤ n ≤ 10^5; 1 ≤ radius[i] ≤ 10^4; 1 ≤ segments ≤ 10^6.
Code runner format: one JSON value per line: radius, then segments. Implement maxSegmentArea(radius, segments) and return the rounded string (e.g. "7.0686").