Tap here to switch tabs
Problem
Submissions

Problem: Reducing Dishes

med
30 min
Try to solve the Reducing Dishes problem.

Statement

A chef has collected data on the satisfaction levels of n dishes, given in an integer array satisfaction.

The chef can cook any dish in 11 unit of time. The like-time coefficient of a dish is defined as the time taken to cook that dish (including all previous dishes) multiplied by its satisfaction level, which equals time $ imes$ satisfaction[i].

Dishes can be prepared in any chosen order, and the chef is allowed to discard any number of dishes to maximize the total value.

Return the maximum sum of the like-time coefficient that the chef can achieve after preparing the dishes.

Constraints:

  • n ==== satisfaction.length

  • 1≤1 \leq n ≤500\leq 500

  • −1000≤-1000 \leq satisfaction[i] ≤1000\leq 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Reducing Dishes

med
30 min
Try to solve the Reducing Dishes problem.

Statement

A chef has collected data on the satisfaction levels of n dishes, given in an integer array satisfaction.

The chef can cook any dish in 11 unit of time. The like-time coefficient of a dish is defined as the time taken to cook that dish (including all previous dishes) multiplied by its satisfaction level, which equals time $ imes$ satisfaction[i].

Dishes can be prepared in any chosen order, and the chef is allowed to discard any number of dishes to maximize the total value.

Return the maximum sum of the like-time coefficient that the chef can achieve after preparing the dishes.

Constraints:

  • n ==== satisfaction.length

  • 1≤1 \leq n ≤500\leq 500

  • −1000≤-1000 \leq satisfaction[i] ≤1000\leq 1000