Find Minimum Inefficienty

Problem Overview

  • Find the minimum inefficiency by replacing each '?' in serverType so adjacent servers with different attributes are minimized.
  • Input: string serverType of length n with '0','1','?'; Output: integer minimum inefficiency; Constraints: 1 ≤ n ≤ 1e5.
  • Context: models AWS servers where '0' = high fault tolerance and '1' = high reliability; inefficiency is the count of differing adjacent pairs.
  • From Amazon 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: