← Google questions
CodingReported in a candidate post, Feb 2025

Array Shrinking

Filed under Google

Given an array, identify duplicate elements. For each duplicate, replace the middle occurrence with the sum of all occurrences of that element, while maintaining the relative order of other elements.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Google questions

Collected from public candidate posts and coding forums. Updated Nov 2026.