Katkat
Online Assessment

Minimizing a String by Removing AB and BB

J.P. MorganSoftware Engineer · Online Assessment · Sep 2026

[Problem description] Given a string seq consisting only of the characters 'A' and 'B'. You can repeatedly perform the following operation: Delete any occurrence of the substring "AB" or "BB". After deletion, the remaining parts of the string are joined together. Your task is to determine the minimum possible length of the string after any number of valid deletions. Note: A substring is a contigu…

Shared by a candidate · reported Sep 2026. Interview formats change; use it as a guide, not a script.