Product of the Maximum and Minimum in a Dataset

Problem Overview

  • Maintain a dynamic collection of integers; after each query, report the product of the current minimum and maximum.
  • Input: arrays s[n] of operations ("push" or "pop") and x[n] values; Output: int[n] of products after each operation.
  • Constraints: 1 ≤ n ≤ 1e5, 1 ≤ x[i] ≤ 1e9; every pop targets an existing value.
  • Context: models real-time data updates and extreme-value monitoring in datasets.
  • This coding interview problem is a Goldman interviews 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: