Download beautiful-towers-i.json from FPEvalRepoPublic/LeetCodeMetaData: direct link, hf CLI and curl.
- Browser
- Download file 1.98 kB
-
https://huggingface.co/datasets/FPEvalRepoPublic/LeetCodeMetaData/resolve/main/beautiful-towers-i.json
- Command line
-
hf download hf://datasets/FPEvalRepoPublic/LeetCodeMetaData/beautiful-towers-i.json
-
curl -L -o beautiful-towers-i.json https://huggingface.co/datasets/FPEvalRepoPublic/LeetCodeMetaData/resolve/main/beautiful-towers-i.json
1.98 kB
| { | |
| "id": 3114, | |
| "name": "beautiful-towers-i", | |
| "difficulty": "Medium", | |
| "link": "https://leetcode.com/problems/beautiful-towers-i/", | |
| "date": "2023-09-17", | |
| "task_description": "You are given an array `heights` of `n` integers representing the number of bricks in `n` consecutive towers. Your task is to remove some bricks to form a **mountain-shaped** tower arrangement. In this arrangement, the tower heights are non-decreasing, reaching a maximum peak value with one or multiple consecutive towers and then non-increasing. Return the **maximum possible sum** of heights of a mountain-shaped tower arrangement. **Example 1:** **Input:** heights = [5,3,4,1,1] **Output:** 13 **Explanation:** We remove some bricks to make `heights = [5,3,3,1,1]`, the peak is at index 0. **Example 2:** **Input:** heights = [6,5,3,9,2,7] **Output:** 22 **Explanation:** We remove some bricks to make `heights = [3,3,3,9,2,2]`, the peak is at index 3. **Example 3:** **Input:** heights = [3,2,5,5,2,3] **Output:** 18 **Explanation:** We remove some bricks to make `heights = [2,2,5,5,2,2]`, the peak is at index 2 or 3. **Constraints:** `1 <= n == heights.length <= 103` `1 <= heights[i] <= 109`", | |
| "test_case": [ | |
| { | |
| "label": "Example 1", | |
| "input": "heights = [5,3,4,1,1]", | |
| "output": "13 " | |
| }, | |
| { | |
| "label": "Example 2", | |
| "input": "heights = [6,5,3,9,2,7]", | |
| "output": "22 " | |
| }, | |
| { | |
| "label": "Example 3", | |
| "input": "heights = [3,2,5,5,2,3]", | |
| "output": "18 " | |
| } | |
| ], | |
| "constraints": [ | |
| "1 <= n == heights.length <= 103", | |
| "1 <= heights[i] <= 109" | |
| ], | |
| "python_template": "class Solution(object):\n def maximumSumOfHeights(self, heights):\n \"\"\"\n :type heights: List[int]\n :rtype: int\n \"\"\"\n ", | |
| "java_template": "class Solution {\n public long maximumSumOfHeights(int[] heights) {\n \n }\n}", | |
| "metadata": { | |
| "func_name": "maximumSumOfHeights" | |
| } | |
| } |