Tap here to switch tabs
Problem
Submissions

Problem: Maximize the Confusion of an Exam

med
30 min
Try to solve the Maximize the Confusion of an Exam problem.

Statement

You are given a string answerKey, where each character represents an answer to a question as either 'T' or 'F'. You are also given an integer k.

In a single operation, you can change the character at any position of answerKey to either 'T' or 'F'.

Return the maximum length of a substring containing consecutive identical characters in answerKey after performing at most k operations.

Constraints:

  • n ==== answerKey.length

  • 1≤1 \leq n ≤5imes104\leq 5 imes 10^4

  • answerKey[i] is either 'T' or 'F'

  • 1≤1 \leq k ≤\leq n

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximize the Confusion of an Exam

med
30 min
Try to solve the Maximize the Confusion of an Exam problem.

Statement

You are given a string answerKey, where each character represents an answer to a question as either 'T' or 'F'. You are also given an integer k.

In a single operation, you can change the character at any position of answerKey to either 'T' or 'F'.

Return the maximum length of a substring containing consecutive identical characters in answerKey after performing at most k operations.

Constraints:

  • n ==== answerKey.length

  • 1≤1 \leq n ≤5imes104\leq 5 imes 10^4

  • answerKey[i] is either 'T' or 'F'

  • 1≤1 \leq k ≤\leq n