Company: Boomi_13oct
Difficulty: medium
Generating Login Codes Problem Description At a software firm, every employee's sign-in relies on two arrays: initialLogin , holding n entries, and standardLogin , holding m entries. The security software repeatedly applies one operation to either array: Pick any contiguous run of elements in either array and collapse it down to a single element equal to the sum of that run. For example, the array [1, 5, 6, 8, 2] can be transformed into [12, 8, 2] by replacing the subsegment [1, 5, 6] with [12] . Applying this operation freely to both initialLogin and standardLogin , the aim is to make the two arrays identical while keeping their shared length as large as possible. That largest achievable shared length is the login code. When no sequence of operations can ever make the two arrays match, initialLogin is deemed invalid and the answer should be -1. Work out the login code for the given initialLogin and standardLogin , returning -1 if initialLogin turns out to be invalid. Complete the func