FPEvalRepoPublic/LeetCodeMetaData
0399
1{2 "id": 3775,3 "name": "separate-squares-ii",4 "difficulty": "Hard",5 "link": "https://leetcode.com/problems/separate-squares-ii/",6 "date": "2025-02-01",7 "task_description": "You are given a 2D integer array `squares`. Each `squares[i] = [xi, yi, li]` represents the coordinates of the bottom-left point and the side length of a square parallel to the x-axis. Find the **minimum** y-coordinate value of a horizontal line such that the total area covered by squares above the line _equals_ the total area covered by squares below the line. Answers within `10-5` of the actual answer will be accepted. **Note**: Squares **may** overlap. Overlapping areas should be counted **only once** in this version. **Example 1:** **Input:** squares = [[0,0,1],[2,2,1]] **Output:** 1.00000 **Explanation:** Any horizontal line between `y = 1` and `y = 2` results in an equal split, with 1 square unit above and 1 square unit below. The minimum y-value is 1. **Example 2:** **Input:** squares = [[0,0,2],[1,1,1]] **Output:** 1.00000 **Explanation:** Since the blue square overlaps with the red square, it will not be counted again. Thus, the line `y = 1` splits the squares into two equal parts. **Constraints:** `1 <= squares.length <= 5 * 104` `squares[i] = [xi, yi, li]` `squares[i].length == 3` `0 <= xi, yi <= 109` `1 <= li <= 109` The total area of all the squares will not exceed `1015`.",8 "test_case": [9 {10 "label": "Example 1",11 "input": "squares = [[0,0,1],[2,2,1]]",12 "output": "1.00000 "13 },14 {15 "label": "Example 2",16 "input": "squares = [[0,0,2],[1,1,1]]",17 "output": "1.00000 "18 }19 ],20 "constraints": [21 "1 <= squares.length <= 5 * 104",22 "squares[i] = [xi, yi, li]",23 "squares[i].length == 3",24 "0 <= xi, yi <= 109",25 "1 <= li <= 109",26 "The total area of all the squares will not exceed 1015."27 ],28 "python_template": "class Solution(object):\n def separateSquares(self, squares):\n \"\"\"\n :type squares: List[List[int]]\n :rtype: float\n \"\"\"\n ",29 "java_template": "class Solution {\n public double separateSquares(int[][] squares) {\n \n }\n}",30 "metadata": {31 "func_name": "separateSquares"32 }33}