Get Maximum Events

Problem Overview

  • Select a subset of events and reorder them so optimizedPayload has three segments: strictly increasing, strictly decreasing, then strictly increasing.
  • Input: array payload[n] of event payload sizes; Output: the maximum number of events included.
  • Constraints: 2 ≤ n ≤ 2×10^5, values up to 10^9, with at least two distinct elements.
  • Domain: event processing/analytics arrangement problem.
  • Asked in Amazon interviews; a common coding interview 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: