Min Cost to Remove Subsequence

Problem Overview

  • Determine the minimum total cost to remove characters so that no permutation of password contains reference as a subsequence.
  • Inputs: password string, reference string, and cost[26] mapping 'a'-'z'; Output: a long integer minimum cost.
  • Constraints: lowercase letters; lengths up to 1e5; nonnegative per-letter costs.
  • Real-world context: Amazon password strength feature; asked in Amazon interviews as 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: