Find Minimum Cost

Problem Overview

  • Find the minimum total cost to supply required energy to all houses using two solar panel types.
  • Input: A (energy needed per house), prices X and Y; Output: minimal cost that meets all demands.
  • Type 1 provides A[k] power for price X; Type 2 provides 2*A[k] for price Y; Type 2 power can be allocated across houses (non-sequential).
  • Real-world context: optimizing residential solar allocation.
  • A Microsoft interviews 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: