Starlight

Easyrubrik

Problem Overview

  • Determine the maximum possible beauty (max sum of any consecutive subarray, can be 0) after optionally multiplying one contiguous segment by z.
  • Input: array arr of star luminance (n up to 2e5, values up to 1e9; negatives allowed), integer z in [-100, 100]. Output: integer maximum beauty after at most one amplification.
  • Context: constellation/starlight model; arrays and subarrays domain.
  • From Rubrik interviews; a coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: