Company: Amex_23july

Difficulty: medium

Problem Statement

OCR Output Equivalence Problem Description Two paper documents were digitized through optical character recognition (OCR), the process of turning printed text into machine-readable strings. Both scans came out low quality, so several letters were not recognized by the software. Your task is to decide, using only the OCR output, whether the two scans could have come from the exact same original passage. Each passage is made up solely of English letters. Whenever the OCR software fails to recognize a letter, that position is first marked with a "?". For instance, if the second and third letters of "AppLe" were not recognized, the raw OCR output would look like "A??Le". To keep the output compact, every run of K consecutive "?" marks is then replaced with the decimal digits of K (never with a leading zero). Under that rule, "A??Le" becomes "A2Le". (A run is collapsed this way only when it cannot be extended further left or right — i.e., it is a maximal run of unrecognized letters.) You ar

More Amex_23july OA questionsInterview experiences