Trains the technique from
LeetCode 1878Get Biggest Three Rhombus Sums in a GridThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A board of numbers is given as grid.
A diamond is picked by naming a top cell and a size. At size zero the diamond is that single cell. At size d the four corners sit at the top cell, d steps down-right of it, 2d steps straight down, and d steps down-left, and the diamond is the outline joining those four corners along the diagonals. A diamond counts only when it fits inside the board.
Each diamond has a weight: the total of the cells on its outline, corners counted once. Return the three largest distinct weights, largest first. Return every distinct weight, still largest first, when fewer than three exist.
Example 1
The heaviest single cell is 200, then 40 and then 30, and no diamond outline of size one or more beats those three, so the three largest distinct weights come from single cells.
Example 2
Every cell holds 6, so the only weights are 6 from a single cell and 24 from the one outline of size one that fits. Two distinct weights exist, so both are returned.
Example 3
A single cell is the only diamond on the board.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def get_biggest_three(grid: list[list[int]]) -> list[int]:public int[] getBiggestThree(int[][] grid)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.