Skip to content

Practice Select Cells in Grid With Maximum Score

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Hard#3276
LeetCode Problem

Select Cells in Grid With Maximum Score

Problem Statement

Given a positive integer grid, choose one or more cells such that no two chosen cells belong to the same row and all chosen values are distinct. Return the maximum possible sum of their values.

Source: Select Cells in Grid With Maximum Score on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
grid = [[1,2,3],[4,3,2],[1,1,1]]
Output
8

# Example 2

Input
grid = [[8,7,6],[8,3,2]]
Output
15

Constraints

1 <= grid.length, grid[i].length <= 10
1 <= grid[i][j] <= 100

Related LeetCode Problems

Practice more problems similar to Select Cells in Grid With Maximum Score.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.