Algorithm · Amazon · Hard
You are given two strings s and t. You can edit s using any of three elementary operations: inserting a single character anywhere, deleting any one character, or replacing one character with another. Find the minimum number of such operations required to change s into t. Example 1: Explanation: Replace the first character ‘a’ with ‘b’, and replace ‘b’ with ‘a’, achieving the transformation in two steps. Example 2: Explanation: Insert ‘y’ at the front → “yabc”, then replace…