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.
primary = "zc" secondary = "d"
There are three possible merge arrangements:
The minimum number of merge conflicts possible is 2.
The function getMinimumConflicts takes the following input: string primary: the commit sequence of the primary branch string secondary: the commit sequence of the secondary branch
int: the minimum number of conflicts after a valid merge
Code with cisco - CwC 26 • Pending