Company: MetLife
Difficulty: medium
Optimal Array Concatenation Problem body { font-family: Arial, sans-serif; line-height: 1.6; } .problem-container { max-width: 800px; margin: 0 auto; padding: 20px; border: 1px solid #ccc; border-radius: 8px; background-color: #f9f9f9; } h3 { color: #333; } .problem-description, .input-format, .output-format, .constraints, .examples { margin-bottom: 20px; } .example { background-color: #fff; padding: 10px; border: 1px solid #ddd; border-radius: 4px; } pre { background-color: #f4f4f4; padding: 10px; border: 1px solid #ddd; border-radius: 4px; overflow-x: auto; } .explanation { margin-top: 10px; color: #555; } Optimal Array Concatenation You are given an array a of length N and an array b of length M . The goal is to construct a new array c by performing a total of N+M operations. In one operation, you can do one of the following: If the array a is not empty, remove its first element and append it to the end of the array c . If the array b is not empty, remove its first element and appen