← Microsoft questions
CodingReported in a candidate post, Nov 2017

Modify array elements and shift zeros to the right

Filed under Microsoft

Given an array, double elements if arr[i] == arr[i+1] and set the next element to zero. After processing, move all zeros to the end of the array while maintaining the relative order of non-zero…

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 Microsoft questions

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