← Cognizant questions
CodingEasy

Invert array bits based on equal adjacent neighbors

Filed under Cognizant

Given an array of 0s and 1s, create a new array where a bit is flipped (0 to 1 or 1 to 0) if its left and right neighbors in the original array are equal. Assume out-of-bounds neighbors are 0.

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

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