Find Minimum Idleness

Problem Overview

  • Given a shader string of 'a'/'b' for two GPUs, find the minimum idleness, defined as the longest consecutive use of the same GPU.
  • You may flip up to switchCount characters ('a'↔'b') to reduce that maximum run.
  • Input: String shader, int switchCount; Output: int minimum achievable idleness.
  • Context: game rendering and dual-GPU scheduling.
  • From Salesforce interviews; a coding interview problem and common 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: