Solve array duplicate flags and binary swaps | Salesforce Interview Question