FastPrepFastPrep
Problem Brief

Light Sources 🩡

INTERNOA

In the expanse of a linear coordinate line, a celestial spectacle unfolds as numerous luminous orbs, each possessing its unique radiance, are strategically placed. The intricate details of these radiant spheres are cataloged within a two-dimensional array, dubbed "celestialArrangements." Each entry in this array encapsulates the essence of a single orb, revealing both its position and the extent of its luminosity.

Within the realm of "celestialArrangements":

  • The ethereal coordinates of the ith orb are encapsulated in celestialArrangements[i][0].
  • Manifesting its brilliance, the positive radius of the ith orb's radiance is manifested through celestialArrangements[i][1].
  • As the night unfolds, each orb casts its enchanting glow, spanning from celestialArrangements[i][0] - celestialArrangements[i][1] to celestialArrangements[i][0] + celestialArrangements[i][1], inclusively.

    Yet, amidst this celestial ballet, a quest awaits. Adventurers must discern the mystical allure of those coordinates touched by the singular radiance of exactly one orb.

    For original prompt, pls refer to source images Λšβ‚Šβ€§κ’°αƒπŸΈΰ»’κ’± β€§β‚ŠΛš

    🐳🫧 Credit to ʚ robot ɞ ♫⋆qβ™ͺ β‚ŠΛšβ™¬ .

    1Example 1

    Input
    lightSources = [[-2, 3], [2, 3], [2, 1]]
    Output
    6
    Explanation
    Example 1 illustration
    For a set of luminous orbs with their respective radii, represented as [[-2, 3], [2, 3], [2, 1]], the resulting illumination yields 6 distinct sections. In the visual depiction, both overlapping and separate illuminated areas are observed, extending along the coordinate line from -6 to 6.

    Constraints

    Limits and guarantees your solution can rely on.

    Unknown for now
    public int lamps(int[][] lightSources) {
      // write your code here
    }
    
    Input

    lightSources

    [[-2, 3], [2, 3], [2, 1]]

    Output

    6

    Sign in to submit your solution.