Given an array of integers, iterate through it and whenever the number 2 is encountered, insert an extra 2 directly after it. Elements shifted off the end are dropped to maintain original length.
You've read your 3 free write-ups
Sign up free to keep reading. Your account opens the first 10 questions of every company.