Company: User Submitted
Difficulty: medium
At Amazon, developers want to merge primary and secondary source control branches into a unified branch while preserving the order of commits from each branch. Each character of a branch represents a commit's priority, with lower alphabetical order indicating higher priority. A conflict occurs when, in the merged branch, a commit with lower priority is placed before a commit with higher priority. Your task is to find the minimum number of conflicts in any valid merge of primary and secondary branches. Example primary = "zc" secondary = "d" There are three possible merge arrangements: "zcd" with 2 merge conflicts ('z' being lower priority is placed before higher priority commits 'c' and 'd') Similarly, "zdc" with 3 merge conflicts Similarly, "dzc" with 2 merge conflicts The minimum number of merge conflicts possible is 2. Function Description The function getMinimumConflicts takes the following input: string primary : the commit sequence of the primary branch string secondary : the comm