Count Good Strings

Problem Overview

  • Given N, count length-2N strings over A and B that are "good": exactly N A's, N B's, and in every prefix count(A) ≥ count(B).
  • Input: integer N; Output: number of good strings modulo 10000.
  • Domain: string combinatorics and prefix-balance validation, akin to balanced sequences.
  • This coding interview problem is a Commvault interview question from their interviews.
  • Large counts are expected; require modulo handling.

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: