Official algorithmic problem description and constraints.
You are given two binary strings π and π. A binary string is a string consisting of the characters '0' and '1'.
Your task is to determine the maximum possible number π such that a prefix of string π of length π is a subsequence of string π.
A sequence π is a subsequence of a sequence π if π can be obtained from π by the deletion of several (possibly, zero or all) elements.
Detailed video explanations, mathematical intuition, and clean C++ implementation code.